{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3f827184",
   "metadata": {},
   "source": [
    "### 数据操作"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "400702d0",
   "metadata": {},
   "source": [
    "张量表示由一个数值组成的数组，这个数组可能有多个维度。      \n",
    "一维的张量是向量，二维的张量是矩阵。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c24f3bb1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "x = torch.arange(12)\n",
    "x"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "28cf29f7",
   "metadata": {},
   "source": [
    "张量中的元素个数使用numel()方法，shape()方法表示张量各个轴的长度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "56c902db",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "shape: torch.Size([12])\n",
      "张量的元素个数： 12\n"
     ]
    }
   ],
   "source": [
    "print(\"shape:\",x.shape)\n",
    "print(\"张量的元素个数：\",x.numel())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f81ef36",
   "metadata": {},
   "source": [
    "改变张量的形状      \n",
    "可以使用-1来调用自动计算出维度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "09af8b76",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X: tensor([[ 0,  1,  2,  3],\n",
      "        [ 4,  5,  6,  7],\n",
      "        [ 8,  9, 10, 11]])\n",
      "X: tensor([[ 0,  1,  2],\n",
      "        [ 3,  4,  5],\n",
      "        [ 6,  7,  8],\n",
      "        [ 9, 10, 11]])\n"
     ]
    }
   ],
   "source": [
    "X = x.reshape(3,4)\n",
    "print(\"X:\",X)\n",
    "X = x.reshape(-1,3)\n",
    "print(\"X:\",X)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "315d05a9",
   "metadata": {},
   "source": [
    "初始化矩阵:      \n",
    "* 生成全零的张量    \n",
    "* 生成全一的张量    \n",
    "* 从某个特定的概率分布中随机采样来得到张量中每个元素的值    \n",
    "* 定义一个张量      "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "c9fdef19",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[[0., 0., 0., 0., 0.],\n",
      "         [0., 0., 0., 0., 0.],\n",
      "         [0., 0., 0., 0., 0.]],\n",
      "\n",
      "        [[0., 0., 0., 0., 0.],\n",
      "         [0., 0., 0., 0., 0.],\n",
      "         [0., 0., 0., 0., 0.]]])\n",
      "tensor([[[1., 1., 1., 1., 1.],\n",
      "         [1., 1., 1., 1., 1.],\n",
      "         [1., 1., 1., 1., 1.]],\n",
      "\n",
      "        [[1., 1., 1., 1., 1.],\n",
      "         [1., 1., 1., 1., 1.],\n",
      "         [1., 1., 1., 1., 1.]]])\n",
      "tensor([[ 0.1462, -0.6242,  0.7009, -0.2617],\n",
      "        [-0.7875,  0.7784, -0.3842, -1.6107],\n",
      "        [-0.8585,  2.2729, -0.6823, -0.5431]])\n",
      "tensor([[2, 3, 4],\n",
      "        [1, 2, 7],\n",
      "        [4, 6, 3]])\n"
     ]
    }
   ],
   "source": [
    "x1 = torch.zeros((2,3,5))\n",
    "print(x1)\n",
    "x2 = torch.ones(2,3,5)\n",
    "print(x2)\n",
    "x3 = torch.randn(3,4)\n",
    "print(x3)\n",
    "x4 = torch.tensor([[2,3,4],[1,2,7],[4,6,3]])\n",
    "print(x4)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d091c297",
   "metadata": {},
   "source": [
    "张量按元素计算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "20ad81c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([ 4.,  5.,  7., 11.]),\n",
       " tensor([-2., -1.,  1.,  5.]),\n",
       " tensor([ 3.,  6., 12., 24.]),\n",
       " tensor([0.3333, 0.6667, 1.3333, 2.6667]),\n",
       " tensor([  1.,   8.,  64., 512.]))"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = torch.tensor([1.0,2,4,8])\n",
    "y = torch.tensor([3,3,3,3])\n",
    "x + y,x - y,x * y,x / y,x ** y"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d8fc018c",
   "metadata": {},
   "source": [
    "张量的一元运算"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "dd7391d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([2.7183e+00, 7.3891e+00, 5.4598e+01, 2.9810e+03])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "torch.exp(x)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0ce2f585",
   "metadata": {},
   "source": [
    "张量的拼接"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c5e47adc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[ 0.,  1.,  2.,  3.],\n",
       "         [ 4.,  5.,  6.,  7.],\n",
       "         [ 8.,  9., 10., 11.],\n",
       "         [ 2.,  1.,  4.,  3.],\n",
       "         [ 1.,  2.,  3.,  4.],\n",
       "         [ 4.,  3.,  2.,  1.]]),\n",
       " tensor([[ 0.,  1.,  2.,  3.,  2.,  1.,  4.,  3.],\n",
       "         [ 4.,  5.,  6.,  7.,  1.,  2.,  3.,  4.],\n",
       "         [ 8.,  9., 10., 11.,  4.,  3.,  2.,  1.]]))"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = torch.arange(12,dtype=torch.float32).reshape((3,4))\n",
    "Y = torch.tensor([[2.0,1,4,3],[1,2,3,4],[4,3,2,1]])\n",
    "# 按行拼接,按列拼接\n",
    "torch.cat((X,Y),dim=0),torch.cat((X,Y),dim=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cb2901cd",
   "metadata": {},
   "source": [
    "张量的比较和元素求和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "1f02a543",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[ True, False,  True, False],\n",
      "        [False, False, False, False],\n",
      "        [False, False, False, False]])\n",
      "tensor(66.)\n"
     ]
    }
   ],
   "source": [
    "print(X < Y)\n",
    "print(X.sum())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9162f4e5",
   "metadata": {},
   "source": [
    "广播机制"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "191cf01d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[0],\n",
       "         [1],\n",
       "         [2]]),\n",
       " tensor([[0, 1]]))"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = torch.arange(3).reshape((3,1))\n",
    "b = torch.arange(2).reshape((1,2))\n",
    "a,b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "af3bd52b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[0, 1],\n",
       "        [1, 2],\n",
       "        [2, 3]])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 3X1和1X2矩阵广播成3X2矩阵\n",
    "a + b"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1c7ed213",
   "metadata": {},
   "source": [
    "切片和索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "75c0db1d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([ 8.,  9., 10., 11.]),\n",
       " tensor([[ 4.,  5.,  6.,  7.],\n",
       "         [ 8.,  9., 10., 11.]]))"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X[-1],X[1:3]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27d6608d",
   "metadata": {},
   "source": [
    "改变指定索引的元素"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e9bca6b2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 0.,  1.,  2.,  3.],\n",
       "        [ 4.,  5., 10.,  7.],\n",
       "        [ 8.,  9., 10., 11.]])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X[1,2] = 10\n",
    "X"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "573082bb",
   "metadata": {},
   "source": [
    "给多个元素赋值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "d403fbfd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[12., 12., 12., 12.],\n",
       "        [12., 12., 12., 12.],\n",
       "        [ 8.,  9., 10., 11.]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X[0:2,:] = 12\n",
    "X"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8513607d",
   "metadata": {},
   "source": [
    "节省内存"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "de78a35d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "id(Z): 1617793502976\n",
      "id(Z): 1617793502976\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Z = torch.zeros_like(Y)\n",
    "print(\"id(Z):\",id(Z))\n",
    "Z[:] = X + Y\n",
    "print(\"id(Z):\",id(Z))\n",
    "\n",
    "before = id(X) \n",
    "X += Y\n",
    "id(X) == before"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "adc88c45",
   "metadata": {},
   "source": [
    "转化为其他的python对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "09a7099f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(numpy.ndarray, torch.Tensor)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = X.numpy()\n",
    "B = torch.tensor(A)\n",
    "type(A),type(B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e20238cf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([3.5000]), 3.5, 3.5, 3)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = torch.tensor([3.5])\n",
    "a,a.item(),float(a),int(a)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "314642cf",
   "metadata": {},
   "source": [
    "### 数据预处理"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b8a2894f",
   "metadata": {},
   "source": [
    "读取数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "5ba24972",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   NumRooms Alley   Price\n",
      "0       NaN  Pave  127500\n",
      "1       2.0   NaN  106000\n",
      "2       4.0   NaN  178100\n",
      "3       NaN   NaN  140000\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "\n",
    "os.makedirs(os.path.join('..','data'),exist_ok=True)\n",
    "data_file = os.path.join('..', 'data', 'house_tiny.csv')\n",
    "with open(data_file,'w') as f:\n",
    "    f.write('NumRooms,Alley,Price\\n')\n",
    "    f.write('NA,Pave,127500\\n')\n",
    "    f.write('2,NA,106000\\n')\n",
    "    f.write('4,NA,178100\\n')\n",
    "    f.write('NA,NA,140000')\n",
    "\n",
    "data = pd.read_csv(data_file)\n",
    "print(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f87437b8",
   "metadata": {},
   "source": [
    "处理缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "e24d7fbc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   NumRooms Alley\n",
      "0       3.0  Pave\n",
      "1       2.0   NaN\n",
      "2       4.0   NaN\n",
      "3       3.0   NaN\n"
     ]
    }
   ],
   "source": [
    "inputs,outputs = data.iloc[:,0:2],data.iloc[:,2]\n",
    "# 使用均值代替缺失值\n",
    "inputs = inputs.fillna(inputs.mean())\n",
    "print(inputs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "eee9230b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   NumRooms  Alley_Pave  Alley_nan\n",
      "0       3.0           1          0\n",
      "1       2.0           0          1\n",
      "2       4.0           0          1\n",
      "3       3.0           0          1\n"
     ]
    }
   ],
   "source": [
    "inputs = pd.get_dummies(inputs,dummy_na=True)\n",
    "print(inputs)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "39704bae",
   "metadata": {},
   "source": [
    "转化张量格式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "2135adab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[3., 1., 0.],\n",
       "         [2., 0., 1.],\n",
       "         [4., 0., 1.],\n",
       "         [3., 0., 1.]], dtype=torch.float64),\n",
       " tensor([127500, 106000, 178100, 140000]))"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "X, y = torch.tensor(inputs.values),torch.tensor(outputs.values)\n",
    "X, y"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "195a63c0",
   "metadata": {},
   "source": [
    "删除缺失值最多的列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "c60eb6f5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NumRooms</th>\n",
       "      <th>Price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NaN</td>\n",
       "      <td>127500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>106000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4.0</td>\n",
       "      <td>178100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>140000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   NumRooms   Price\n",
       "0       NaN  127500\n",
       "1       2.0  106000\n",
       "2       4.0  178100\n",
       "3       NaN  140000"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import torch\n",
    "\n",
    "# 删除缺失值最多的列\n",
    "number = []\n",
    "names = ['NumRooms','Alley','Price']\n",
    "for name in names:\n",
    "    a = np.sum(data[name].isnull())\n",
    "    number.append(a)\n",
    "data = data.drop(names[np.argmax(number)],axis=1) \n",
    "data   "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5ae37263",
   "metadata": {},
   "source": [
    "### 线性代数"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "884a0c75",
   "metadata": {},
   "source": [
    "标量，标量由只有一个元素的张量表示"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "edb2fa5b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor(5.), tensor(6.), tensor(1.5000), tensor(9.))"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "x = torch.tensor(3.0)\n",
    "y = torch.tensor(2.0)\n",
    "x+y,x*y,x/y,x**y"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b8321c14",
   "metadata": {},
   "source": [
    "向量，一维张量处理向量，被视为标量值组成的列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3ba78d84",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([0, 1, 2, 3])\n",
      "tensor(3)\n"
     ]
    }
   ],
   "source": [
    "x = torch.arange(4)\n",
    "print(x)\n",
    "print(x[3])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5ca3757b",
   "metadata": {},
   "source": [
    "长度、维度和形状"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6120b51a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n",
      "torch.Size([4])\n"
     ]
    }
   ],
   "source": [
    "print(len(x))\n",
    "print(x.shape)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c273524a",
   "metadata": {},
   "source": [
    "矩阵，二维张量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "fe5d26a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 0,  1,  2,  3],\n",
       "        [ 4,  5,  6,  7],\n",
       "        [ 8,  9, 10, 11],\n",
       "        [12, 13, 14, 15],\n",
       "        [16, 17, 18, 19]])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = torch.arange(20).reshape(5,4)\n",
    "A"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c72e2e51",
   "metadata": {},
   "source": [
    "矩阵的转置，当我们交换矩阵的行和列时，结果称为矩阵的转置（transpose）。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b6741b79",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 0,  4,  8, 12, 16],\n",
       "        [ 1,  5,  9, 13, 17],\n",
       "        [ 2,  6, 10, 14, 18],\n",
       "        [ 3,  7, 11, 15, 19]])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.T"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "999f7d8a",
   "metadata": {},
   "source": [
    "对称矩阵：A 等于其转置： A=A⊤ 。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "bdfe50d0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[1, 2, 3],\n",
      "        [2, 0, 4],\n",
      "        [3, 4, 5]])\n",
      "tensor([[1, 2, 3],\n",
      "        [2, 0, 4],\n",
      "        [3, 4, 5]])\n",
      "tensor([[True, True, True],\n",
      "        [True, True, True],\n",
      "        [True, True, True]])\n"
     ]
    }
   ],
   "source": [
    "B = torch.tensor([[1,2,3],[2,0,4],[3,4,5]])\n",
    "print(B)\n",
    "print(B.T)\n",
    "print(B == B.T)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bd7f4a46",
   "metadata": {},
   "source": [
    "张量为我们提供了描述具有任意数量轴的 n 维数组的通用方法。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "149302ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[[ 0,  1,  2,  3],\n",
       "         [ 4,  5,  6,  7],\n",
       "         [ 8,  9, 10, 11]],\n",
       "\n",
       "        [[12, 13, 14, 15],\n",
       "         [16, 17, 18, 19],\n",
       "         [20, 21, 22, 23]]])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X = torch.arange(24).reshape(2,3,4)\n",
    "X"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "16cf8a16",
   "metadata": {},
   "source": [
    "给定具有相同形状的任意两个张量，任何按元素二元运算的结果都将是相同形状的张量。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "e0a4c0e4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[ 0.,  1.,  2.,  3.],\n",
       "         [ 4.,  5.,  6.,  7.],\n",
       "         [ 8.,  9., 10., 11.],\n",
       "         [12., 13., 14., 15.],\n",
       "         [16., 17., 18., 19.]]),\n",
       " tensor([[ 0.,  2.,  4.,  6.],\n",
       "         [ 8., 10., 12., 14.],\n",
       "         [16., 18., 20., 22.],\n",
       "         [24., 26., 28., 30.],\n",
       "         [32., 34., 36., 38.]]),\n",
       " tensor([[  0.,   1.,   4.,   9.],\n",
       "         [ 16.,  25.,  36.,  49.],\n",
       "         [ 64.,  81., 100., 121.],\n",
       "         [144., 169., 196., 225.],\n",
       "         [256., 289., 324., 361.]]))"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = torch.arange(20,dtype=torch.float32).reshape(5,4)\n",
    "B = A.clone()\n",
    "A,A+B,A*B,"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "834c359b",
   "metadata": {},
   "source": [
    "将张量乘以或加上一个标量不会改变张量的形状，其中张量的每个元素都将与标量相加或相乘。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "fd5df9ca",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[[ 3,  4,  5,  6,  7],\n",
       "          [ 8,  9, 10, 11, 12]],\n",
       " \n",
       "         [[13, 14, 15, 16, 17],\n",
       "          [18, 19, 20, 21, 22]]]),\n",
       " torch.Size([2, 2, 5]))"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = 3\n",
    "X = torch.arange(20).reshape(2,2,5)\n",
    "a+X,(a*X).shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a27074d9",
   "metadata": {},
   "source": [
    "对张量所有元素求和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "1fe8a096",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([0., 1., 2., 3.]), tensor(6.))"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x = torch.arange(4,dtype=torch.float32)\n",
    "x,x.sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3b10c925",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(torch.Size([5, 4]), tensor(190.))"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.shape,A.sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "950391fc",
   "metadata": {},
   "source": [
    "调用求和函数会沿所有的轴降低张量的维度，使它变为一个标量;还可以指定张量沿哪一个轴来通过求和降低维度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "268464d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([ 6., 22., 38., 54., 70.]), torch.Size([5]))"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A_ax0 = A.sum(axis=1)\n",
    "A_ax0,A_ax0.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0de6105f",
   "metadata": {},
   "source": [
    "沿着行和列对矩阵求和，等价于对矩阵的所有元素进行求和。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "12b87225",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor(190.)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.sum(axis=[0,1])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "774025c7",
   "metadata": {},
   "source": [
    "与求和相关的量是平均值,也可以通过将总和除以元素总数来计算平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "d83bdda5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor(9.5000),\n",
       " tensor(9.5000),\n",
       " tensor([ 8.,  9., 10., 11.]),\n",
       " tensor([ 8.,  9., 10., 11.]))"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.mean(),A.sum()/A.numel(),A.mean(axis=0), A.sum(axis=0) / A.shape[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "897cb420",
   "metadata": {},
   "source": [
    "非降维求和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "231a82b6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([[ 6.],\n",
       "         [22.],\n",
       "         [38.],\n",
       "         [54.],\n",
       "         [70.]]),\n",
       " tensor([[0.0000, 0.1667, 0.3333, 0.5000],\n",
       "         [0.1818, 0.2273, 0.2727, 0.3182],\n",
       "         [0.2105, 0.2368, 0.2632, 0.2895],\n",
       "         [0.2222, 0.2407, 0.2593, 0.2778],\n",
       "         [0.2286, 0.2429, 0.2571, 0.2714]]))"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum_A = A.sum(axis=1,keepdim=True)\n",
    "sum_A,A/sum_A"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ab354c07",
   "metadata": {},
   "source": [
    "如果我们想沿某个轴计算A元素的累积总和， 比如axis=0（按行计算），我们可以调用cumsum函数。 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "cbcb1fc2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 0.,  1.,  2.,  3.],\n",
       "        [ 4.,  6.,  8., 10.],\n",
       "        [12., 15., 18., 21.],\n",
       "        [24., 28., 32., 36.],\n",
       "        [40., 45., 50., 55.]])"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.cumsum(axis=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2f1445ed",
   "metadata": {},
   "source": [
    "点积"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "00b4be7b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(tensor([0., 1., 2., 3.]), tensor([1., 1., 1., 1.]), tensor(6.), tensor(6.))"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y = torch.ones(4,dtype=torch.float32)\n",
    "x,y,torch.dot(x,y),torch.sum(x * y)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "74b04ae8",
   "metadata": {},
   "source": [
    "矩阵-向量积"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "aa99304b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(torch.Size([5, 4]), torch.Size([4]), tensor([ 14.,  38.,  62.,  86., 110.]))"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A.shape,x.shape,torch.mv(A,x)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7e5a85b8",
   "metadata": {},
   "source": [
    "矩阵乘法：将矩阵-矩阵乘法 AB 看作是简单地执行 m 次矩阵-向量积，并将结果拼接在一起，形成一个 n×m 矩阵"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "b4a0f2f2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[ 6.,  6.,  6.],\n",
       "        [22., 22., 22.],\n",
       "        [38., 38., 38.],\n",
       "        [54., 54., 54.],\n",
       "        [70., 70., 70.]])"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "B = torch.ones(4,3)\n",
    "torch.mm(A,B)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0b2b3b1",
   "metadata": {},
   "source": [
    "范数：L1范数，L2范数，Lp范数，Frobenius范数（矩阵的L2范数）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "36de70b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor(5.)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "u = torch.tensor([3.0,-4.0])\n",
    "torch.norm(u)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "ddad2ffc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor(7.)"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "torch.abs(u).sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "30c2d16a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor(6.)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "torch.norm(torch.ones((4,9)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8dce616d",
   "metadata": {},
   "source": [
    "### 微积分"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e45dda6",
   "metadata": {},
   "source": [
    "假设我们有一个函数 f:Rn→R ，其输入和输出都是标量。如果 f′(a) 存在，则称 f 在 a 处是可微（differentiable）的。 如果 f 在一个区间内的每个数上都是可微的，则此函数在此区间中是可微的。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ce6ea251",
   "metadata": {},
   "source": [
    "![Snipaste_2022-02-18_15-39-04.png](https://tva1.sinaimg.cn/large/005T39qaly1gzhpowm6rqj30h20bcgmn.jpg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c3c8b7a5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "h=0.10000,numerical limit=2.30000\n",
      "h=0.01000,numerical limit=2.03000\n",
      "h=0.00100,numerical limit=2.00300\n",
      "h=0.00010,numerical limit=2.00030\n",
      "h=0.00001,numerical limit=2.00003\n"
     ]
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import numpy as np \n",
    "from IPython import display\n",
    "from d2l import torch as d2l\n",
    "\n",
    "def f(x):\n",
    "    return 3 * x ** 2 - 4*x\n",
    "\n",
    "def numerical_lim(f,x,h):\n",
    "    return (f(x+h) - f(x)) / h\n",
    "\n",
    "h = 0.1\n",
    "for i in range(5):\n",
    "    print(f'h={h:.5f},numerical limit={numerical_lim(f,1,h):.5f}')\n",
    "    h *= 0.1\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f06ae0cf",
   "metadata": {},
   "source": [
    "导数进行可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "327d36f1",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\ADMINI~1.DES\\AppData\\Local\\Temp/ipykernel_11232/3899239211.py:3: DeprecationWarning: `set_matplotlib_formats` is deprecated since IPython 7.23, directly use `matplotlib_inline.backend_inline.set_matplotlib_formats()`\n",
      "  display.set_matplotlib_formats('svg')\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"243.529359pt\" height=\"180.65625pt\" viewBox=\"0 0 243.529359 180.65625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2022-02-18T16:45:13.980636</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.5.1, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 180.65625 \nL 243.529359 180.65625 \nL 243.529359 0 \nL 0 0 \nL 0 180.65625 \nz\n\" style=\"fill: none\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 40.603125 143.1 \nL 235.903125 143.1 \nL 235.903125 7.2 \nL 40.603125 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 49.480398 143.1 \nL 49.480398 7.2 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"m4ff7268308\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m4ff7268308\" x=\"49.480398\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- 0 -->\n      <g transform=\"translate(46.299148 157.698438)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 110.702968 143.1 \nL 110.702968 7.2 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m4ff7268308\" x=\"110.702968\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- 1 -->\n      <g transform=\"translate(107.521718 157.698438)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-31\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 171.925539 143.1 \nL 171.925539 7.2 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m4ff7268308\" x=\"171.925539\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 2 -->\n      <g transform=\"translate(168.744289 157.698438)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 233.148109 143.1 \nL 233.148109 7.2 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#m4ff7268308\" x=\"233.148109\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- 3 -->\n      <g transform=\"translate(229.966859 157.698438)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \nQ 3050 2419 3304 2112 \nQ 3559 1806 3559 1356 \nQ 3559 666 3084 287 \nQ 2609 -91 1734 -91 \nQ 1441 -91 1130 -33 \nQ 819 25 488 141 \nL 488 750 \nQ 750 597 1062 519 \nQ 1375 441 1716 441 \nQ 2309 441 2620 675 \nQ 2931 909 2931 1356 \nQ 2931 1769 2642 2001 \nQ 2353 2234 1838 2234 \nL 1294 2234 \nL 1294 2753 \nL 1863 2753 \nQ 2328 2753 2575 2939 \nQ 2822 3125 2822 3475 \nQ 2822 3834 2567 4026 \nQ 2313 4219 1838 4219 \nQ 1578 4219 1281 4162 \nQ 984 4106 628 3988 \nL 628 4550 \nQ 988 4650 1302 4700 \nQ 1616 4750 1894 4750 \nQ 2613 4750 3031 4423 \nQ 3450 4097 3450 3541 \nQ 3450 3153 3228 2886 \nQ 3006 2619 2597 2516 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-33\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_5\">\n     <!-- x -->\n     <g transform=\"translate(135.29375 171.376563)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \nL 2247 1797 \nL 3578 0 \nL 2900 0 \nL 1881 1375 \nL 863 0 \nL 184 0 \nL 1544 1831 \nL 300 3500 \nL 978 3500 \nL 1906 2253 \nL 2834 3500 \nL 3513 3500 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-78\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_9\">\n      <path d=\"M 40.603125 114.635514 \nL 235.903125 114.635514 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <defs>\n       <path id=\"mff05c9d3d4\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mff05c9d3d4\" x=\"40.603125\" y=\"114.635514\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 0 -->\n      <g transform=\"translate(27.240625 118.434732)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_11\">\n      <path d=\"M 40.603125 77.490157 \nL 235.903125 77.490157 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#mff05c9d3d4\" x=\"40.603125\" y=\"77.490157\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 5 -->\n      <g transform=\"translate(27.240625 81.289376)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-35\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_13\">\n      <path d=\"M 40.603125 40.344801 \nL 235.903125 40.344801 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#mff05c9d3d4\" x=\"40.603125\" y=\"40.344801\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 10 -->\n      <g transform=\"translate(20.878125 44.14402)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-31\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_9\">\n     <!-- f(x) -->\n     <g transform=\"translate(14.798437 83.771094)rotate(-90)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-66\" d=\"M 2375 4863 \nL 2375 4384 \nL 1825 4384 \nQ 1516 4384 1395 4259 \nQ 1275 4134 1275 3809 \nL 1275 3500 \nL 2222 3500 \nL 2222 3053 \nL 1275 3053 \nL 1275 0 \nL 697 0 \nL 697 3053 \nL 147 3053 \nL 147 3500 \nL 697 3500 \nL 697 3744 \nQ 697 4328 969 4595 \nQ 1241 4863 1831 4863 \nL 2375 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-28\" d=\"M 1984 4856 \nQ 1566 4138 1362 3434 \nQ 1159 2731 1159 2009 \nQ 1159 1288 1364 580 \nQ 1569 -128 1984 -844 \nL 1484 -844 \nQ 1016 -109 783 600 \nQ 550 1309 550 2009 \nQ 550 2706 781 3412 \nQ 1013 4119 1484 4856 \nL 1984 4856 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-29\" d=\"M 513 4856 \nL 1013 4856 \nQ 1481 4119 1714 3412 \nQ 1947 2706 1947 2009 \nQ 1947 1309 1714 600 \nQ 1481 -109 1013 -844 \nL 513 -844 \nQ 928 -128 1133 580 \nQ 1338 1288 1338 2009 \nQ 1338 2731 1133 3434 \nQ 928 4138 513 4856 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-66\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"35.205078\"/>\n      <use xlink:href=\"#DejaVuSans-78\" x=\"74.21875\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"133.398438\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_15\">\n    <path d=\"M 49.480398 114.635514 \nL 55.602655 117.38427 \nL 61.724912 119.687282 \nL 67.847169 121.54455 \nL 73.969426 122.956073 \nL 80.091683 123.921853 \nL 86.21394 124.441888 \nL 92.336197 124.516178 \nL 98.458454 124.144725 \nL 104.580711 123.327527 \nL 110.702968 122.064585 \nL 116.825225 120.355898 \nL 122.947482 118.201468 \nL 129.069739 115.601293 \nL 135.191996 112.555374 \nL 141.314254 109.06371 \nL 147.436511 105.126302 \nL 153.558768 100.74315 \nL 159.681025 95.914254 \nL 165.803282 90.639614 \nL 171.925539 84.919229 \nL 178.047796 78.7531 \nL 184.170053 72.141226 \nL 190.29231 65.083608 \nL 196.414567 57.580247 \nL 202.536824 49.63114 \nL 208.659081 41.23629 \nL 214.781338 32.395695 \nL 220.903595 23.109356 \nL 227.025852 13.377273 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_16\">\n    <path d=\"M 49.480398 136.922727 \nL 55.602655 135.436913 \nL 61.724912 133.951099 \nL 67.847169 132.465285 \nL 73.969426 130.97947 \nL 80.091683 129.493656 \nL 86.21394 128.007842 \nL 92.336197 126.522028 \nL 98.458454 125.036213 \nL 104.580711 123.550399 \nL 110.702968 122.064585 \nL 116.825225 120.578771 \nL 122.947482 119.092956 \nL 129.069739 117.607142 \nL 135.191996 116.121328 \nL 141.314254 114.635514 \nL 147.436511 113.149699 \nL 153.558768 111.663885 \nL 159.681025 110.178071 \nL 165.803282 108.692257 \nL 171.925539 107.206442 \nL 178.047796 105.720628 \nL 184.170053 104.234814 \nL 190.29231 102.749 \nL 196.414567 101.263185 \nL 202.536824 99.777371 \nL 208.659081 98.291557 \nL 214.781338 96.805743 \nL 220.903595 95.319928 \nL 227.025852 93.834114 \n\" clip-path=\"url(#p0ad6a50bac)\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #bf00bf; stroke-width: 1.5\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 40.603125 143.1 \nL 40.603125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 235.903125 143.1 \nL 235.903125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 40.603125 143.1 \nL 235.903125 143.1 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 40.603125 7.2 \nL 235.903125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"legend_1\">\n    <g id=\"patch_7\">\n     <path d=\"M 47.603125 44.55625 \nL 168.975 44.55625 \nQ 170.975 44.55625 170.975 42.55625 \nL 170.975 14.2 \nQ 170.975 12.2 168.975 12.2 \nL 47.603125 12.2 \nQ 45.603125 12.2 45.603125 14.2 \nL 45.603125 42.55625 \nQ 45.603125 44.55625 47.603125 44.55625 \nz\n\" style=\"fill: #ffffff; opacity: 0.8; stroke: #cccccc; stroke-linejoin: miter\"/>\n    </g>\n    <g id=\"line2d_17\">\n     <path d=\"M 49.603125 20.298437 \nL 59.603125 20.298437 \nL 69.603125 20.298437 \n\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_10\">\n     <!-- f(x) -->\n     <g transform=\"translate(77.603125 23.798437)scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-66\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"35.205078\"/>\n      <use xlink:href=\"#DejaVuSans-78\" x=\"74.21875\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"133.398438\"/>\n     </g>\n    </g>\n    <g id=\"line2d_18\">\n     <path d=\"M 49.603125 34.976562 \nL 59.603125 34.976562 \nL 69.603125 34.976562 \n\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #bf00bf; stroke-width: 1.5\"/>\n    </g>\n    <g id=\"text_11\">\n     <!-- Tangent line(x=1) -->\n     <g transform=\"translate(77.603125 38.476562)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-54\" d=\"M -19 4666 \nL 3928 4666 \nL 3928 4134 \nL 2272 4134 \nL 2272 0 \nL 1638 0 \nL 1638 4134 \nL -19 4134 \nL -19 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \nQ 1497 1759 1228 1600 \nQ 959 1441 959 1056 \nQ 959 750 1161 570 \nQ 1363 391 1709 391 \nQ 2188 391 2477 730 \nQ 2766 1069 2766 1631 \nL 2766 1759 \nL 2194 1759 \nz\nM 3341 1997 \nL 3341 0 \nL 2766 0 \nL 2766 531 \nQ 2569 213 2275 61 \nQ 1981 -91 1556 -91 \nQ 1019 -91 701 211 \nQ 384 513 384 1019 \nQ 384 1609 779 1909 \nQ 1175 2209 1959 2209 \nL 2766 2209 \nL 2766 2266 \nQ 2766 2663 2505 2880 \nQ 2244 3097 1772 3097 \nQ 1472 3097 1187 3025 \nQ 903 2953 641 2809 \nL 641 3341 \nQ 956 3463 1253 3523 \nQ 1550 3584 1831 3584 \nQ 2591 3584 2966 3190 \nQ 3341 2797 3341 1997 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6e\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-67\" d=\"M 2906 1791 \nQ 2906 2416 2648 2759 \nQ 2391 3103 1925 3103 \nQ 1463 3103 1205 2759 \nQ 947 2416 947 1791 \nQ 947 1169 1205 825 \nQ 1463 481 1925 481 \nQ 2391 481 2648 825 \nQ 2906 1169 2906 1791 \nz\nM 3481 434 \nQ 3481 -459 3084 -895 \nQ 2688 -1331 1869 -1331 \nQ 1566 -1331 1297 -1286 \nQ 1028 -1241 775 -1147 \nL 775 -588 \nQ 1028 -725 1275 -790 \nQ 1522 -856 1778 -856 \nQ 2344 -856 2625 -561 \nQ 2906 -266 2906 331 \nL 2906 616 \nQ 2728 306 2450 153 \nQ 2172 0 1784 0 \nQ 1141 0 747 490 \nQ 353 981 353 1791 \nQ 353 2603 747 3093 \nQ 1141 3584 1784 3584 \nQ 2172 3584 2450 3431 \nQ 2728 3278 2906 2969 \nL 2906 3500 \nL 3481 3500 \nL 3481 434 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \nL 1172 3500 \nL 2356 3500 \nL 2356 3053 \nL 1172 3053 \nL 1172 1153 \nQ 1172 725 1289 603 \nQ 1406 481 1766 481 \nL 2356 481 \nL 2356 0 \nL 1766 0 \nQ 1100 0 847 248 \nQ 594 497 594 1153 \nL 594 3053 \nL 172 3053 \nL 172 3500 \nL 594 3500 \nL 594 4494 \nL 1172 4494 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-20\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-69\" d=\"M 603 3500 \nL 1178 3500 \nL 1178 0 \nL 603 0 \nL 603 3500 \nz\nM 603 4863 \nL 1178 4863 \nL 1178 4134 \nL 603 4134 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-3d\" d=\"M 678 2906 \nL 4684 2906 \nL 4684 2381 \nL 678 2381 \nL 678 2906 \nz\nM 678 1631 \nL 4684 1631 \nL 4684 1100 \nL 678 1100 \nL 678 1631 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-54\"/>\n      <use xlink:href=\"#DejaVuSans-61\" x=\"44.583984\"/>\n      <use xlink:href=\"#DejaVuSans-6e\" x=\"105.863281\"/>\n      <use xlink:href=\"#DejaVuSans-67\" x=\"169.242188\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"232.71875\"/>\n      <use xlink:href=\"#DejaVuSans-6e\" x=\"294.242188\"/>\n      <use xlink:href=\"#DejaVuSans-74\" x=\"357.621094\"/>\n      <use xlink:href=\"#DejaVuSans-20\" x=\"396.830078\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" x=\"428.617188\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"456.400391\"/>\n      <use xlink:href=\"#DejaVuSans-6e\" x=\"484.183594\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"547.5625\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"609.085938\"/>\n      <use xlink:href=\"#DejaVuSans-78\" x=\"648.099609\"/>\n      <use xlink:href=\"#DejaVuSans-3d\" x=\"707.279297\"/>\n      <use xlink:href=\"#DejaVuSans-31\" x=\"791.068359\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"854.691406\"/>\n     </g>\n    </g>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p0ad6a50bac\">\n   <rect x=\"40.603125\" y=\"7.2\" width=\"195.3\" height=\"135.9\"/>\n  </clipPath>\n </defs>\n</svg>\n",
      "text/plain": [
       "<Figure size 252x180 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from matplotlib import pyplot as plt\n",
    "def use_svg_display():\n",
    "    display.set_matplotlib_formats('svg')\n",
    "\n",
    "def set_figsize(figsize=(3.5,2.5)):\n",
    "    use_svg_display()\n",
    "    plt.rcParams['figure.figsize'] = figsize\n",
    "\n",
    "# 设置图表的轴的属性\n",
    "def set_axes(axes,xlabel,ylabel,xlim,ylim,xscale,yscale,legend):\n",
    "    axes.set_xlabel(xlabel)\n",
    "    axes.set_ylabel(ylabel)\n",
    "    axes.set_xscale(xscale)\n",
    "    axes.set_yscale(yscale)\n",
    "    axes.set_xlim(xlim)\n",
    "    axes.set_ylim(ylim)\n",
    "    if legend:\n",
    "        axes.legend(legend)\n",
    "    axes.grid()\n",
    "\n",
    "# 图形配置的函数，plot函数来简洁地绘制多条曲线\n",
    "def plot(X,Y=None,xlabel=None,ylabel=None,legend=None,xlim=None,\n",
    "        ylim=None,xscale='linear',yscale='linear',\n",
    "        fmts=('-','m--','g-.','r:'),figsize=(3.5,2.5),axes=None):\n",
    "    if legend is None:\n",
    "        legend = []\n",
    "    set_figsize(figsize)\n",
    "    axes = axes if axes else plt.gca()\n",
    "    def has_one_axis(X):\n",
    "        return  (hasattr(X,\"ndim\") and X.ndim == 1 or isinstance(X,list) and not hasattr(X[0],\"__len__\"))\n",
    "    if has_one_axis(X):\n",
    "        X = [X]\n",
    "    if Y is None:\n",
    "        X,Y = [[]] * len(X),X \n",
    "    elif has_one_axis(Y):\n",
    "        Y = [Y]\n",
    "    if len(X) != len(Y):\n",
    "        X = X * len(Y)\n",
    "    axes.cla()\n",
    "    for x,y,fmt in zip(X,Y,fmts):\n",
    "        if len(x):\n",
    "            axes.plot(x,y,fmt)\n",
    "        else:\n",
    "            axes.plot(y,fmt)\n",
    "    set_axes(axes,xlabel,ylabel,xlim,ylim,xscale,yscale,legend)  \n",
    "\n",
    "x = np.arange(0,3,0.1)\n",
    "plot(x,[f(x),2*x-3],'x','f(x)',legend=['f(x)','Tangent line(x=1)'])                 \n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7a742e77",
   "metadata": {},
   "source": [
    "### 偏导数\n",
    "设 y=f(x1,x2,…,xn) 是一个具有 n 个变量的函数。  y 关于第 i 个参数 xi 的偏导数（partial derivative）为：\n",
    "![偏导数.png](https://tva1.sinaimg.cn/large/005T39qaly1gzhrpykctqj30h2022wej.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e4aa48cf",
   "metadata": {},
   "source": [
    "我们可以连结一个多元函数对其所有变量的偏导数，以得到该函数的梯度（gradient）向量。\n",
    "微分多元函数的规则：\n",
    "![规则.png](https://tva1.sinaimg.cn/large/005T39qaly1gzhs30lxhmj30c903sweu.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0b13c631",
   "metadata": {},
   "source": [
    "### 链式法则\n",
    "单变量函数： 假设函数y=f(u)和u=g(x)都是可微的，根据链式法则：\n",
    "![1.png](https://tva1.sinaimg.cn/large/005T39qaly1gzhs6we8inj303v01s744.jpg)\n",
    "![2.png](https://tva1.sinaimg.cn/large/005T39qaly1gzhs76wmrxj30ax01vt8q.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "666fd839",
   "metadata": {},
   "source": [
    "### 自动微分"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d92028b7",
   "metadata": {},
   "source": [
    "深度学习框架通过自动计算导数，即自动微分（automatic differentiation）来加快求导。 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "8f1c119a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([0., 1., 2., 3.])\n",
      "tensor(28., grad_fn=<MulBackward0>)\n",
      "backward: None\n",
      "grad: tensor([ 0.,  4.,  8., 12.])\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "tensor([True, True, True, True])"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "\n",
    "x = torch.arange(4.0)\n",
    "print(x)\n",
    "x.requires_grad_(True)\n",
    "# y=2x⊤x\n",
    "y = 2 * torch.dot(x,x)\n",
    "print(y)\n",
    "print(\"backward:\",y.backward())\n",
    "print(\"grad:\",x.grad)\n",
    "x.grad == 4 * x\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "a52161b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(None, tensor([1., 1., 1., 1.]))"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 梯度清除\n",
    "x.grad.zero_()\n",
    "y = x.sum()\n",
    "# backward()反向传播\n",
    "y.backward(),x.grad"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a522fdb0",
   "metadata": {},
   "source": [
    "#### 非标量变量的反向传播\n",
    "当y不是标量时，向量y关于向量x的导数的最自然解释是一个矩阵。 对于高阶和高维的y和x，求导的结果可以是一个高阶张量。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "fc425f2e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([0., 2., 4., 6.])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.grad.zero_()\n",
    "y = x * x\n",
    "# y.sum().backward()\n",
    "y.backward(torch.ones(len(x)))\n",
    "x.grad"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0699d9d6",
   "metadata": {},
   "source": [
    "分离计算：有时，我们希望将某些计算移动到记录的计算图之外。\n",
    "* 我们可以分离y来返回一个新变量u，该变量与y具有相同的值， 但丢弃计算图中如何计算y的任何信息。 换句话说，梯度不会向后流经u到x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "b6e30ce2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([True, True, True, True])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.grad.zero_()\n",
    "y = x * x\n",
    "u = y.detach()\n",
    "z = u * x\n",
    "z.sum().backward()\n",
    "x.grad == u"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "7298d87e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([True, True, True, True])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.grad.zero_()\n",
    "y.sum().backward()\n",
    "x.grad == 2 * x"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d4aa0787",
   "metadata": {},
   "source": [
    "即使构建函数的计算图需要通过Python控制流（例如，条件、循环或任意函数调用），我们仍然可以计算得到的变量的梯度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "858646ba",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor(1457.2355, grad_fn=<MulBackward0>)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "tensor(True)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def f(a):\n",
    "    b = a * 2\n",
    "    while b.norm() < 1000:\n",
    "        b = b * 2\n",
    "    if b.sum() > 0:\n",
    "        c = b\n",
    "    else:\n",
    "        c = 100 * b\n",
    "    return c\n",
    "\n",
    "a =  torch.randn(size=(),requires_grad=True)\n",
    "d = f(a)\n",
    "d.backward()\n",
    "a.grad == d / a"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "563d629b",
   "metadata": {},
   "source": [
    "### 概率\n",
    "* 机器学习就是做出预测。\n",
    "* 概率是一种灵活的语言，用于说明我们的确定程度，并且它可以有效地应用于广泛的领域中"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7d76aacb",
   "metadata": {},
   "source": [
    "大数定律（law of large numbers）告诉我们： 随着投掷次数的增加，这个估计值会越来越接近真实的潜在概率。       \n",
    "我们把从概率分布中抽取样本的过程称为抽样（sampling）。 笼统来说，可以把分布（distribution）看作是对事件的概率分配， 稍后我们将给出的更正式定义。 将概率分配给一些离散选择的分布称为多项分布（multinomial distribution)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1b2af0f7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([0., 0., 0., 0., 0., 1.])"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import torch\n",
    "from torch.distributions import multinomial\n",
    "from d2l import torch as d2l\n",
    "\n",
    "fair_probs = torch.ones([6]) / 6\n",
    "multinomial.Multinomial(1,fair_probs).sample()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43e07b7d",
   "metadata": {},
   "source": [
    "抽取多个样本"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "abb0dcf6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([2., 3., 1., 2., 1., 1.])"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "multinomial.Multinomial(10,fair_probs).sample()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eb67eb51",
   "metadata": {},
   "source": [
    "抽取1000个样本"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0b760f0b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([0.1360, 0.1850, 0.1830, 0.1640, 0.1660, 0.1660])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "counts = multinomial.Multinomial(1000,fair_probs).sample()\n",
    "counts/1000"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "005f614b",
   "metadata": {},
   "source": [
    "随着时间的推移收敛到真实概率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "f3bb43fc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[  4.,   3.,   1.,   1.,   0.,   1.],\n",
      "        [  6.,   5.,   4.,   2.,   1.,   2.],\n",
      "        [  8.,   7.,   5.,   5.,   3.,   2.],\n",
      "        ...,\n",
      "        [804., 824., 836., 862., 845., 809.],\n",
      "        [808., 824., 838., 865., 846., 809.],\n",
      "        [812., 824., 838., 867., 847., 812.]])\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"392.14375pt\" height=\"289.37625pt\" viewBox=\"0 0 392.14375 289.37625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2022-02-20T16:01:39.082444</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.5.1, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 289.37625 \nL 392.14375 289.37625 \nL 392.14375 0 \nL 0 0 \nL 0 289.37625 \nz\n\" style=\"fill: none\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 50.14375 251.82 \nL 384.94375 251.82 \nL 384.94375 7.2 \nL 50.14375 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <defs>\n       <path id=\"m0499efde5c\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m0499efde5c\" x=\"65.361932\" y=\"251.82\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- 0 -->\n      <g transform=\"translate(62.180682 266.418437)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \nQ 1547 4250 1301 3770 \nQ 1056 3291 1056 2328 \nQ 1056 1369 1301 889 \nQ 1547 409 2034 409 \nQ 2525 409 2770 889 \nQ 3016 1369 3016 2328 \nQ 3016 3291 2770 3770 \nQ 2525 4250 2034 4250 \nz\nM 2034 4750 \nQ 2819 4750 3233 4129 \nQ 3647 3509 3647 2328 \nQ 3647 1150 3233 529 \nQ 2819 -91 2034 -91 \nQ 1250 -91 836 529 \nQ 422 1150 422 2328 \nQ 422 3509 836 4129 \nQ 1250 4750 2034 4750 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_2\">\n      <g>\n       <use xlink:href=\"#m0499efde5c\" x=\"126.356649\" y=\"251.82\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- 100 -->\n      <g transform=\"translate(116.812899 266.418437)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-31\" d=\"M 794 531 \nL 1825 531 \nL 1825 4091 \nL 703 3866 \nL 703 4441 \nL 1819 4666 \nL 2450 4666 \nL 2450 531 \nL 3481 531 \nL 3481 0 \nL 794 0 \nL 794 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-31\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_3\">\n      <g>\n       <use xlink:href=\"#m0499efde5c\" x=\"187.351365\" y=\"251.82\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- 200 -->\n      <g transform=\"translate(177.807615 266.418437)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \nL 3431 531 \nL 3431 0 \nL 469 0 \nL 469 531 \nQ 828 903 1448 1529 \nQ 2069 2156 2228 2338 \nQ 2531 2678 2651 2914 \nQ 2772 3150 2772 3378 \nQ 2772 3750 2511 3984 \nQ 2250 4219 1831 4219 \nQ 1534 4219 1204 4116 \nQ 875 4013 500 3803 \nL 500 4441 \nQ 881 4594 1212 4672 \nQ 1544 4750 1819 4750 \nQ 2544 4750 2975 4387 \nQ 3406 4025 3406 3419 \nQ 3406 3131 3298 2873 \nQ 3191 2616 2906 2266 \nQ 2828 2175 2409 1742 \nQ 1991 1309 1228 531 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-32\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m0499efde5c\" x=\"248.346082\" y=\"251.82\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- 300 -->\n      <g transform=\"translate(238.802332 266.418437)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \nQ 3050 2419 3304 2112 \nQ 3559 1806 3559 1356 \nQ 3559 666 3084 287 \nQ 2609 -91 1734 -91 \nQ 1441 -91 1130 -33 \nQ 819 25 488 141 \nL 488 750 \nQ 750 597 1062 519 \nQ 1375 441 1716 441 \nQ 2309 441 2620 675 \nQ 2931 909 2931 1356 \nQ 2931 1769 2642 2001 \nQ 2353 2234 1838 2234 \nL 1294 2234 \nL 1294 2753 \nL 1863 2753 \nQ 2328 2753 2575 2939 \nQ 2822 3125 2822 3475 \nQ 2822 3834 2567 4026 \nQ 2313 4219 1838 4219 \nQ 1578 4219 1281 4162 \nQ 984 4106 628 3988 \nL 628 4550 \nQ 988 4650 1302 4700 \nQ 1616 4750 1894 4750 \nQ 2613 4750 3031 4423 \nQ 3450 4097 3450 3541 \nQ 3450 3153 3228 2886 \nQ 3006 2619 2597 2516 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-33\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_5\">\n      <g>\n       <use xlink:href=\"#m0499efde5c\" x=\"309.340799\" y=\"251.82\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 400 -->\n      <g transform=\"translate(299.797049 266.418437)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \nL 825 1625 \nL 2419 1625 \nL 2419 4116 \nz\nM 2253 4666 \nL 3047 4666 \nL 3047 1625 \nL 3713 1625 \nL 3713 1100 \nL 3047 1100 \nL 3047 0 \nL 2419 0 \nL 2419 1100 \nL 313 1100 \nL 313 1709 \nL 2253 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-34\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m0499efde5c\" x=\"370.335515\" y=\"251.82\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 500 -->\n      <g transform=\"translate(360.791765 266.418437)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \nL 3169 4666 \nL 3169 4134 \nL 1269 4134 \nL 1269 2991 \nQ 1406 3038 1543 3061 \nQ 1681 3084 1819 3084 \nQ 2600 3084 3056 2656 \nQ 3513 2228 3513 1497 \nQ 3513 744 3044 326 \nQ 2575 -91 1722 -91 \nQ 1428 -91 1123 -41 \nQ 819 9 494 109 \nL 494 744 \nQ 775 591 1075 516 \nQ 1375 441 1709 441 \nQ 2250 441 2565 725 \nQ 2881 1009 2881 1497 \nQ 2881 1984 2565 2268 \nQ 2250 2553 1709 2553 \nQ 1456 2553 1204 2497 \nQ 953 2441 691 2322 \nL 691 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-35\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"127.246094\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_7\">\n     <!-- Groups of experiments -->\n     <g transform=\"translate(160.397656 280.096562)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-47\" d=\"M 3809 666 \nL 3809 1919 \nL 2778 1919 \nL 2778 2438 \nL 4434 2438 \nL 4434 434 \nQ 4069 175 3628 42 \nQ 3188 -91 2688 -91 \nQ 1594 -91 976 548 \nQ 359 1188 359 2328 \nQ 359 3472 976 4111 \nQ 1594 4750 2688 4750 \nQ 3144 4750 3555 4637 \nQ 3966 4525 4313 4306 \nL 4313 3634 \nQ 3963 3931 3569 4081 \nQ 3175 4231 2741 4231 \nQ 1884 4231 1454 3753 \nQ 1025 3275 1025 2328 \nQ 1025 1384 1454 906 \nQ 1884 428 2741 428 \nQ 3075 428 3337 486 \nQ 3600 544 3809 666 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-72\" d=\"M 2631 2963 \nQ 2534 3019 2420 3045 \nQ 2306 3072 2169 3072 \nQ 1681 3072 1420 2755 \nQ 1159 2438 1159 1844 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1341 3275 1631 3429 \nQ 1922 3584 2338 3584 \nQ 2397 3584 2469 3576 \nQ 2541 3569 2628 3553 \nL 2631 2963 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \nQ 1497 3097 1228 2736 \nQ 959 2375 959 1747 \nQ 959 1119 1226 758 \nQ 1494 397 1959 397 \nQ 2419 397 2687 759 \nQ 2956 1122 2956 1747 \nQ 2956 2369 2687 2733 \nQ 2419 3097 1959 3097 \nz\nM 1959 3584 \nQ 2709 3584 3137 3096 \nQ 3566 2609 3566 1747 \nQ 3566 888 3137 398 \nQ 2709 -91 1959 -91 \nQ 1206 -91 779 398 \nQ 353 888 353 1747 \nQ 353 2609 779 3096 \nQ 1206 3584 1959 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-75\" d=\"M 544 1381 \nL 544 3500 \nL 1119 3500 \nL 1119 1403 \nQ 1119 906 1312 657 \nQ 1506 409 1894 409 \nQ 2359 409 2629 706 \nQ 2900 1003 2900 1516 \nL 2900 3500 \nL 3475 3500 \nL 3475 0 \nL 2900 0 \nL 2900 538 \nQ 2691 219 2414 64 \nQ 2138 -91 1772 -91 \nQ 1169 -91 856 284 \nQ 544 659 544 1381 \nz\nM 1991 3584 \nL 1991 3584 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \nL 1159 -1331 \nL 581 -1331 \nL 581 3500 \nL 1159 3500 \nL 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nz\nM 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \nL 2834 2853 \nQ 2591 2978 2328 3040 \nQ 2066 3103 1784 3103 \nQ 1356 3103 1142 2972 \nQ 928 2841 928 2578 \nQ 928 2378 1081 2264 \nQ 1234 2150 1697 2047 \nL 1894 2003 \nQ 2506 1872 2764 1633 \nQ 3022 1394 3022 966 \nQ 3022 478 2636 193 \nQ 2250 -91 1575 -91 \nQ 1294 -91 989 -36 \nQ 684 19 347 128 \nL 347 722 \nQ 666 556 975 473 \nQ 1284 391 1588 391 \nQ 1994 391 2212 530 \nQ 2431 669 2431 922 \nQ 2431 1156 2273 1281 \nQ 2116 1406 1581 1522 \nL 1381 1569 \nQ 847 1681 609 1914 \nQ 372 2147 372 2553 \nQ 372 3047 722 3315 \nQ 1072 3584 1716 3584 \nQ 2034 3584 2315 3537 \nQ 2597 3491 2834 3397 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-20\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-66\" d=\"M 2375 4863 \nL 2375 4384 \nL 1825 4384 \nQ 1516 4384 1395 4259 \nQ 1275 4134 1275 3809 \nL 1275 3500 \nL 2222 3500 \nL 2222 3053 \nL 1275 3053 \nL 1275 0 \nL 697 0 \nL 697 3053 \nL 147 3053 \nL 147 3500 \nL 697 3500 \nL 697 3744 \nQ 697 4328 969 4595 \nQ 1241 4863 1831 4863 \nL 2375 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \nL 3597 1613 \nL 953 1613 \nQ 991 1019 1311 708 \nQ 1631 397 2203 397 \nQ 2534 397 2845 478 \nQ 3156 559 3463 722 \nL 3463 178 \nQ 3153 47 2828 -22 \nQ 2503 -91 2169 -91 \nQ 1331 -91 842 396 \nQ 353 884 353 1716 \nQ 353 2575 817 3079 \nQ 1281 3584 2069 3584 \nQ 2775 3584 3186 3129 \nQ 3597 2675 3597 1894 \nz\nM 3022 2063 \nQ 3016 2534 2758 2815 \nQ 2500 3097 2075 3097 \nQ 1594 3097 1305 2825 \nQ 1016 2553 972 2059 \nL 3022 2063 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \nL 2247 1797 \nL 3578 0 \nL 2900 0 \nL 1881 1375 \nL 863 0 \nL 184 0 \nL 1544 1831 \nL 300 3500 \nL 978 3500 \nL 1906 2253 \nL 2834 3500 \nL 3513 3500 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-69\" d=\"M 603 3500 \nL 1178 3500 \nL 1178 0 \nL 603 0 \nL 603 3500 \nz\nM 603 4863 \nL 1178 4863 \nL 1178 4134 \nL 603 4134 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6d\" d=\"M 3328 2828 \nQ 3544 3216 3844 3400 \nQ 4144 3584 4550 3584 \nQ 5097 3584 5394 3201 \nQ 5691 2819 5691 2113 \nL 5691 0 \nL 5113 0 \nL 5113 2094 \nQ 5113 2597 4934 2840 \nQ 4756 3084 4391 3084 \nQ 3944 3084 3684 2787 \nQ 3425 2491 3425 1978 \nL 3425 0 \nL 2847 0 \nL 2847 2094 \nQ 2847 2600 2669 2842 \nQ 2491 3084 2119 3084 \nQ 1678 3084 1418 2786 \nQ 1159 2488 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1356 3278 1631 3431 \nQ 1906 3584 2284 3584 \nQ 2666 3584 2933 3390 \nQ 3200 3197 3328 2828 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6e\" d=\"M 3513 2113 \nL 3513 0 \nL 2938 0 \nL 2938 2094 \nQ 2938 2591 2744 2837 \nQ 2550 3084 2163 3084 \nQ 1697 3084 1428 2787 \nQ 1159 2491 1159 1978 \nL 1159 0 \nL 581 0 \nL 581 3500 \nL 1159 3500 \nL 1159 2956 \nQ 1366 3272 1645 3428 \nQ 1925 3584 2291 3584 \nQ 2894 3584 3203 3211 \nQ 3513 2838 3513 2113 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-74\" d=\"M 1172 4494 \nL 1172 3500 \nL 2356 3500 \nL 2356 3053 \nL 1172 3053 \nL 1172 1153 \nQ 1172 725 1289 603 \nQ 1406 481 1766 481 \nL 2356 481 \nL 2356 0 \nL 1766 0 \nQ 1100 0 847 248 \nQ 594 497 594 1153 \nL 594 3053 \nL 172 3053 \nL 172 3500 \nL 594 3500 \nL 594 4494 \nL 1172 4494 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-47\"/>\n      <use xlink:href=\"#DejaVuSans-72\" x=\"77.490234\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" x=\"116.353516\"/>\n      <use xlink:href=\"#DejaVuSans-75\" x=\"177.535156\"/>\n      <use xlink:href=\"#DejaVuSans-70\" x=\"240.914062\"/>\n      <use xlink:href=\"#DejaVuSans-73\" x=\"304.390625\"/>\n      <use xlink:href=\"#DejaVuSans-20\" x=\"356.490234\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" x=\"388.277344\"/>\n      <use xlink:href=\"#DejaVuSans-66\" x=\"449.458984\"/>\n      <use xlink:href=\"#DejaVuSans-20\" x=\"484.664062\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"516.451172\"/>\n      <use xlink:href=\"#DejaVuSans-78\" x=\"576.224609\"/>\n      <use xlink:href=\"#DejaVuSans-70\" x=\"635.404297\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"698.880859\"/>\n      <use xlink:href=\"#DejaVuSans-72\" x=\"760.404297\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"801.517578\"/>\n      <use xlink:href=\"#DejaVuSans-6d\" x=\"829.300781\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"926.712891\"/>\n      <use xlink:href=\"#DejaVuSans-6e\" x=\"988.236328\"/>\n      <use xlink:href=\"#DejaVuSans-74\" x=\"1051.615234\"/>\n      <use xlink:href=\"#DejaVuSans-73\" x=\"1090.824219\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_7\">\n      <defs>\n       <path id=\"mcf43dd0a06\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"240.700909\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 0.00 -->\n      <g transform=\"translate(20.878125 244.500128)scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \nL 1344 794 \nL 1344 0 \nL 684 0 \nL 684 794 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"212.903182\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 0.05 -->\n      <g transform=\"translate(20.878125 216.702401)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_9\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"185.105455\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_10\">\n      <!-- 0.10 -->\n      <g transform=\"translate(20.878125 188.904674)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-31\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"157.307729\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.15 -->\n      <g transform=\"translate(20.878125 161.106947)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-31\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_11\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"129.510002\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.20 -->\n      <g transform=\"translate(20.878125 133.30922)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"101.712275\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 0.25 -->\n      <g transform=\"translate(20.878125 105.511494)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_7\">\n     <g id=\"line2d_13\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"73.914548\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 0.30 -->\n      <g transform=\"translate(20.878125 77.713767)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_8\">\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"46.116821\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 0.35 -->\n      <g transform=\"translate(20.878125 49.91604)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_9\">\n     <g id=\"line2d_15\">\n      <g>\n       <use xlink:href=\"#mcf43dd0a06\" x=\"50.14375\" y=\"18.319094\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_16\">\n      <!-- 0.40 -->\n      <g transform=\"translate(20.878125 22.118313)scale(0.1 -0.1)\">\n       <use xlink:href=\"#DejaVuSans-30\"/>\n       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n       <use xlink:href=\"#DejaVuSans-34\" x=\"95.410156\"/>\n       <use xlink:href=\"#DejaVuSans-30\" x=\"159.033203\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_17\">\n     <!-- Estimated probability -->\n     <g transform=\"translate(14.798438 183.033437)rotate(-90)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-45\" d=\"M 628 4666 \nL 3578 4666 \nL 3578 4134 \nL 1259 4134 \nL 1259 2753 \nL 3481 2753 \nL 3481 2222 \nL 1259 2222 \nL 1259 531 \nL 3634 531 \nL 3634 0 \nL 628 0 \nL 628 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-61\" d=\"M 2194 1759 \nQ 1497 1759 1228 1600 \nQ 959 1441 959 1056 \nQ 959 750 1161 570 \nQ 1363 391 1709 391 \nQ 2188 391 2477 730 \nQ 2766 1069 2766 1631 \nL 2766 1759 \nL 2194 1759 \nz\nM 3341 1997 \nL 3341 0 \nL 2766 0 \nL 2766 531 \nQ 2569 213 2275 61 \nQ 1981 -91 1556 -91 \nQ 1019 -91 701 211 \nQ 384 513 384 1019 \nQ 384 1609 779 1909 \nQ 1175 2209 1959 2209 \nL 2766 2209 \nL 2766 2266 \nQ 2766 2663 2505 2880 \nQ 2244 3097 1772 3097 \nQ 1472 3097 1187 3025 \nQ 903 2953 641 2809 \nL 641 3341 \nQ 956 3463 1253 3523 \nQ 1550 3584 1831 3584 \nQ 2591 3584 2966 3190 \nQ 3341 2797 3341 1997 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-64\" d=\"M 2906 2969 \nL 2906 4863 \nL 3481 4863 \nL 3481 0 \nL 2906 0 \nL 2906 525 \nQ 2725 213 2448 61 \nQ 2172 -91 1784 -91 \nQ 1150 -91 751 415 \nQ 353 922 353 1747 \nQ 353 2572 751 3078 \nQ 1150 3584 1784 3584 \nQ 2172 3584 2448 3432 \nQ 2725 3281 2906 2969 \nz\nM 947 1747 \nQ 947 1113 1208 752 \nQ 1469 391 1925 391 \nQ 2381 391 2643 752 \nQ 2906 1113 2906 1747 \nQ 2906 2381 2643 2742 \nQ 2381 3103 1925 3103 \nQ 1469 3103 1208 2742 \nQ 947 2381 947 1747 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-62\" d=\"M 3116 1747 \nQ 3116 2381 2855 2742 \nQ 2594 3103 2138 3103 \nQ 1681 3103 1420 2742 \nQ 1159 2381 1159 1747 \nQ 1159 1113 1420 752 \nQ 1681 391 2138 391 \nQ 2594 391 2855 752 \nQ 3116 1113 3116 1747 \nz\nM 1159 2969 \nQ 1341 3281 1617 3432 \nQ 1894 3584 2278 3584 \nQ 2916 3584 3314 3078 \nQ 3713 2572 3713 1747 \nQ 3713 922 3314 415 \nQ 2916 -91 2278 -91 \nQ 1894 -91 1617 61 \nQ 1341 213 1159 525 \nL 1159 0 \nL 581 0 \nL 581 4863 \nL 1159 4863 \nL 1159 2969 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \nL 1178 4863 \nL 1178 0 \nL 603 0 \nL 603 4863 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-79\" d=\"M 2059 -325 \nQ 1816 -950 1584 -1140 \nQ 1353 -1331 966 -1331 \nL 506 -1331 \nL 506 -850 \nL 844 -850 \nQ 1081 -850 1212 -737 \nQ 1344 -625 1503 -206 \nL 1606 56 \nL 191 3500 \nL 800 3500 \nL 1894 763 \nL 2988 3500 \nL 3597 3500 \nL 2059 -325 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-45\"/>\n      <use xlink:href=\"#DejaVuSans-73\" x=\"63.183594\"/>\n      <use xlink:href=\"#DejaVuSans-74\" x=\"115.283203\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"154.492188\"/>\n      <use xlink:href=\"#DejaVuSans-6d\" x=\"182.275391\"/>\n      <use xlink:href=\"#DejaVuSans-61\" x=\"279.6875\"/>\n      <use xlink:href=\"#DejaVuSans-74\" x=\"340.966797\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"380.175781\"/>\n      <use xlink:href=\"#DejaVuSans-64\" x=\"441.699219\"/>\n      <use xlink:href=\"#DejaVuSans-20\" x=\"505.175781\"/>\n      <use xlink:href=\"#DejaVuSans-70\" x=\"536.962891\"/>\n      <use xlink:href=\"#DejaVuSans-72\" x=\"600.439453\"/>\n      <use xlink:href=\"#DejaVuSans-6f\" x=\"639.302734\"/>\n      <use xlink:href=\"#DejaVuSans-62\" x=\"700.484375\"/>\n      <use xlink:href=\"#DejaVuSans-61\" x=\"763.960938\"/>\n      <use xlink:href=\"#DejaVuSans-62\" x=\"825.240234\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"888.716797\"/>\n      <use xlink:href=\"#DejaVuSans-6c\" x=\"916.5\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"944.283203\"/>\n      <use xlink:href=\"#DejaVuSans-74\" x=\"972.066406\"/>\n      <use xlink:href=\"#DejaVuSans-79\" x=\"1011.275391\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_16\">\n    <path d=\"M 65.361932 18.319091 \nL 65.971879 73.914541 \nL 66.581826 92.446358 \nL 67.191773 115.611142 \nL 67.80172 118.390912 \nL 68.411668 110.978183 \nL 69.021615 129.51 \nL 69.631562 122.560567 \nL 70.241509 123.332728 \nL 70.851456 135.069548 \nL 71.461403 139.618263 \nL 72.071351 148.041817 \nL 72.681298 146.616292 \nL 73.901192 129.51 \nL 74.511139 136.459433 \nL 75.121086 132.780321 \nL 75.731034 132.598636 \nL 76.950928 137.849318 \nL 78.170822 137.091199 \nL 78.780769 139.178777 \nL 79.390717 136.459433 \nL 80.000664 136.18146 \nL 80.610611 133.786573 \nL 81.220558 135.687272 \nL 82.440452 142.929591 \nL 83.0504 142.482277 \nL 83.660347 143.857217 \nL 84.270294 143.408867 \nL 84.880241 144.672399 \nL 85.490188 144.226443 \nL 86.710083 146.497503 \nL 87.32003 149.043538 \nL 87.929977 149.992537 \nL 88.539924 152.31839 \nL 89.149871 151.748185 \nL 89.759819 153.917762 \nL 90.369766 154.660323 \nL 90.979713 154.075438 \nL 91.58966 154.780662 \nL 92.199607 154.219089 \nL 94.029449 156.149488 \nL 94.639396 155.605826 \nL 95.249343 156.195822 \nL 96.469237 155.169439 \nL 97.079185 153.636333 \nL 98.909026 155.322178 \nL 99.518973 154.869329 \nL 101.348815 156.381135 \nL 103.178656 155.101557 \nL 103.788603 153.833013 \nL 105.008498 156.465371 \nL 106.228392 154.037405 \nL 106.838339 152.070472 \nL 108.058234 146.736764 \nL 109.278128 147.787959 \nL 109.888075 147.54096 \nL 110.498022 148.041817 \nL 111.717917 147.56047 \nL 112.327864 148.041817 \nL 112.937811 149.214718 \nL 113.547758 148.968407 \nL 114.767652 151.205791 \nL 115.3776 151.614219 \nL 115.987547 152.674775 \nL 116.597494 152.402244 \nL 117.207441 153.428976 \nL 117.817388 153.793074 \nL 118.427335 154.780662 \nL 119.037283 153.872057 \nL 119.64723 154.836821 \nL 120.257177 155.169439 \nL 120.867124 156.099135 \nL 122.087018 156.716288 \nL 122.696966 156.429905 \nL 123.306913 157.307725 \nL 124.526807 156.740428 \nL 125.136754 155.342234 \nL 125.746701 154.527955 \nL 126.356649 154.280253 \nL 126.966596 155.127511 \nL 127.576543 154.339038 \nL 128.18649 154.634873 \nL 128.796437 153.866109 \nL 129.406384 153.636333 \nL 130.016332 154.450016 \nL 131.236226 153.992404 \nL 134.285962 155.357013 \nL 136.72575 152.596248 \nL 137.335698 152.869433 \nL 137.945645 152.674775 \nL 138.555592 151.564396 \nL 139.165539 151.839321 \nL 139.775486 151.205791 \nL 140.385433 151.479175 \nL 140.995381 151.303422 \nL 141.605328 151.571687 \nL 142.215275 152.273497 \nL 142.825222 152.529998 \nL 143.435169 152.351544 \nL 144.045116 152.603496 \nL 145.265011 153.938307 \nL 145.874958 153.336622 \nL 146.484905 153.158814 \nL 147.704799 151.99346 \nL 148.314747 151.829347 \nL 150.144588 152.542408 \nL 150.754535 150.801878 \nL 151.364482 151.043451 \nL 151.97443 150.504088 \nL 152.584377 149.200054 \nL 153.804271 149.691914 \nL 155.634113 149.285566 \nL 156.854007 150.496367 \nL 157.463954 150.724055 \nL 158.073901 150.585399 \nL 159.293796 151.748185 \nL 159.903743 150.536489 \nL 160.51369 150.402563 \nL 161.123637 150.622199 \nL 162.343531 150.3583 \nL 162.953479 150.919434 \nL 164.173373 151.338888 \nL 164.78332 151.883784 \nL 165.393267 151.411243 \nL 166.003214 151.614219 \nL 167.833056 151.221838 \nL 168.443003 151.421151 \nL 169.05295 151.293017 \nL 169.662897 150.843143 \nL 170.272845 150.71983 \nL 170.882792 150.917445 \nL 171.492739 150.15974 \nL 172.102686 150.042417 \nL 173.32258 149.187048 \nL 174.542475 149.586139 \nL 175.152422 149.47522 \nL 175.762369 149.976457 \nL 176.372316 150.168422 \nL 176.982263 149.451849 \nL 177.592211 149.344053 \nL 178.202158 149.835225 \nL 178.812105 149.726534 \nL 179.422052 150.210432 \nL 180.031999 150.100913 \nL 180.641946 150.577753 \nL 182.471788 151.114456 \nL 183.081735 151.003089 \nL 183.691682 151.177972 \nL 184.911577 150.957997 \nL 185.521524 150.568889 \nL 186.131471 151.021812 \nL 186.741418 150.914247 \nL 187.351365 150.53117 \nL 187.961312 150.702325 \nL 188.57126 150.597934 \nL 189.181207 151.039615 \nL 189.791154 151.205791 \nL 190.401101 150.830592 \nL 191.011048 150.996163 \nL 192.84089 150.689219 \nL 194.060784 151.0139 \nL 194.670731 151.43497 \nL 195.280678 151.332517 \nL 196.500573 151.645227 \nL 197.11052 151.287019 \nL 197.720467 151.442152 \nL 198.940361 152.253598 \nL 199.550309 152.402244 \nL 200.160256 152.299129 \nL 201.38015 152.592039 \nL 201.990097 152.242364 \nL 203.209992 152.042081 \nL 203.819939 152.430933 \nL 204.429886 152.573615 \nL 205.039833 152.231619 \nL 205.64978 151.651912 \nL 206.259727 151.79611 \nL 206.869675 151.700459 \nL 207.479622 152.080803 \nL 208.089569 152.221339 \nL 208.699516 151.418376 \nL 209.309463 151.560519 \nL 209.91941 151.234273 \nL 211.139305 151.979833 \nL 211.749252 152.117279 \nL 212.359199 152.023864 \nL 213.579093 152.29502 \nL 214.189041 152.202028 \nL 214.798988 152.561776 \nL 215.408935 152.693531 \nL 216.018882 152.1517 \nL 216.628829 152.507315 \nL 219.068618 153.022702 \nL 220.898459 152.095656 \nL 221.508407 152.224097 \nL 222.728301 152.048701 \nL 223.948195 152.302012 \nL 225.16809 152.128686 \nL 225.778037 152.253598 \nL 226.387984 152.587358 \nL 228.217825 152.329027 \nL 228.827773 152.037525 \nL 229.43772 151.954093 \nL 230.047667 152.07642 \nL 231.267561 151.911097 \nL 231.877508 152.032248 \nL 232.487456 151.950349 \nL 233.097403 152.070472 \nL 233.70735 151.788323 \nL 234.317297 151.708188 \nL 234.927244 151.827889 \nL 235.537191 152.145296 \nL 236.757086 151.196173 \nL 237.367033 151.512445 \nL 237.97698 151.630729 \nL 238.586927 151.943257 \nL 239.806822 151.786923 \nL 240.416769 151.516538 \nL 241.026716 151.440388 \nL 242.24661 151.671762 \nL 242.856557 151.405469 \nL 244.076452 151.634722 \nL 245.296346 151.109585 \nL 245.906293 151.036864 \nL 247.736135 151.377551 \nL 248.956029 151.232732 \nL 250.175923 151.455573 \nL 252.005765 151.241124 \nL 252.615712 150.990066 \nL 253.225659 151.100472 \nL 255.055501 150.892866 \nL 255.665448 150.469311 \nL 256.275395 150.579617 \nL 256.885342 150.512729 \nL 257.495289 150.798134 \nL 258.105237 150.555601 \nL 259.325131 150.772212 \nL 259.935078 150.3583 \nL 261.154972 150.228807 \nL 263.594761 150.656736 \nL 264.204708 150.422057 \nL 264.814655 150.527798 \nL 265.424603 150.801878 \nL 266.03455 150.73736 \nL 266.644497 150.337299 \nL 267.864391 150.546123 \nL 269.694233 150.3583 \nL 270.914127 150.563902 \nL 271.524074 150.829788 \nL 272.134021 150.440059 \nL 272.743969 150.37868 \nL 273.353916 150.155101 \nL 274.57381 150.035069 \nL 275.183757 150.136718 \nL 275.793704 149.916428 \nL 276.403652 150.178049 \nL 278.84344 150.576088 \nL 279.453387 150.516242 \nL 280.063335 150.299233 \nL 280.673282 150.554607 \nL 281.893176 150.43638 \nL 283.11307 150.630061 \nL 283.723018 150.571233 \nL 284.332965 150.203863 \nL 284.942912 150.146543 \nL 286.162806 150.339155 \nL 287.992648 150.168422 \nL 288.602595 150.263618 \nL 289.822489 150.151133 \nL 291.042384 150.339569 \nL 291.652331 150.582475 \nL 292.262278 150.376932 \nL 292.872225 150.469783 \nL 293.482172 150.710402 \nL 294.702067 150.892866 \nL 295.312014 150.689219 \nL 295.921961 150.780032 \nL 296.531908 150.724055 \nL 297.141855 150.814297 \nL 298.36175 151.283681 \nL 298.971697 151.371752 \nL 300.191591 151.25848 \nL 300.801538 151.345946 \nL 302.021433 151.233676 \nL 302.63138 151.463079 \nL 303.241327 151.54912 \nL 304.461221 151.436958 \nL 305.071168 151.240204 \nL 306.291063 151.411243 \nL 306.90101 151.076 \nL 307.510957 150.882121 \nL 308.730851 151.053243 \nL 309.340799 150.999518 \nL 309.950746 151.084359 \nL 310.560693 151.306728 \nL 311.17064 151.390392 \nL 311.780587 150.924545 \nL 312.390534 150.871798 \nL 313.000482 151.092511 \nL 313.610429 150.903354 \nL 316.050217 151.235408 \nL 316.660165 151.452036 \nL 317.270112 151.264743 \nL 319.7099 151.588578 \nL 320.319848 151.403199 \nL 320.929795 151.351074 \nL 321.539742 151.43125 \nL 322.149689 151.247561 \nL 322.759636 151.196173 \nL 324.589478 151.43497 \nL 325.199425 151.383623 \nL 325.809372 151.462416 \nL 326.419319 151.411243 \nL 328.249161 151.645227 \nL 330.079002 151.492571 \nL 330.688949 151.187126 \nL 331.298897 151.010305 \nL 331.908844 150.961212 \nL 332.518791 151.038994 \nL 334.348632 150.892866 \nL 335.568527 151.04698 \nL 336.178474 150.998582 \nL 336.788421 151.19971 \nL 338.008315 151.102883 \nL 338.618263 151.302428 \nL 339.22821 151.253998 \nL 339.838157 150.712705 \nL 340.448104 150.911795 \nL 341.058051 150.496367 \nL 341.667998 150.327681 \nL 342.887893 150.480213 \nL 343.49784 150.434334 \nL 344.107787 150.510028 \nL 345.327681 150.418726 \nL 347.157523 150.643481 \nL 347.76747 150.837567 \nL 348.377417 150.911265 \nL 348.987365 151.103943 \nL 349.597312 150.938653 \nL 350.207259 151.011663 \nL 350.817206 151.2029 \nL 352.0371 150.874706 \nL 352.647048 150.593874 \nL 354.476889 150.811836 \nL 355.696783 150.722522 \nL 356.306731 150.794456 \nL 357.526625 151.169066 \nL 358.746519 151.079189 \nL 359.966414 150.645461 \nL 361.796255 151.200216 \nL 362.406202 151.269697 \nL 363.016149 151.111507 \nL 363.626097 151.18088 \nL 364.236044 151.136749 \nL 365.455938 151.274551 \nL 366.065885 151.230495 \nL 366.675832 151.298924 \nL 369.725568 150.413888 \nL 369.725568 150.413888 \n\" clip-path=\"url(#p34e39a5591)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_17\">\n    <path d=\"M 65.361932 73.914541 \nL 65.971879 101.712275 \nL 66.581826 110.978183 \nL 67.191773 101.712275 \nL 67.80172 107.271823 \nL 68.411668 120.244092 \nL 69.021615 121.567793 \nL 69.631562 115.611142 \nL 70.241509 123.332728 \nL 71.461403 134.564136 \nL 72.071351 143.408867 \nL 73.291245 141.423311 \nL 73.901192 148.041817 \nL 74.511139 143.408867 \nL 75.121086 142.591282 \nL 75.731034 144.953181 \nL 76.340981 141.214304 \nL 76.950928 140.629088 \nL 78.170822 144.672399 \nL 78.780769 146.430358 \nL 79.390717 143.408867 \nL 80.000664 145.076725 \nL 80.610611 148.754579 \nL 81.220558 145.982729 \nL 81.830505 145.394414 \nL 82.440452 142.929591 \nL 83.660347 142.063817 \nL 84.270294 145.146223 \nL 84.880241 142.987689 \nL 86.100135 142.217533 \nL 86.710083 143.408867 \nL 87.32003 143.03322 \nL 87.929977 139.751268 \nL 88.539924 138.063146 \nL 89.149871 137.849318 \nL 89.759819 140.357891 \nL 90.979713 142.439173 \nL 91.58966 142.145335 \nL 92.199607 144.335457 \nL 94.639396 143.125218 \nL 95.249343 142.852911 \nL 95.85929 144.771496 \nL 97.079185 144.195592 \nL 97.689132 144.953181 \nL 98.299079 144.672399 \nL 98.909026 141.423311 \nL 99.518973 143.165025 \nL 100.12892 143.888134 \nL 100.738868 141.759847 \nL 101.348815 141.555687 \nL 102.568709 142.960517 \nL 103.178656 144.511947 \nL 104.398551 144.05035 \nL 105.618445 145.275873 \nL 106.838339 148.041817 \nL 108.668181 149.586139 \nL 109.278128 150.834287 \nL 109.888075 148.292253 \nL 111.107969 147.797983 \nL 111.717917 145.394414 \nL 112.327864 143.765244 \nL 112.937811 144.288542 \nL 114.157705 142.550913 \nL 114.767652 143.06987 \nL 115.3776 142.906494 \nL 116.597494 145.207544 \nL 117.207441 144.378552 \nL 117.817388 144.846677 \nL 119.037283 147.000704 \nL 119.64723 146.806369 \nL 120.867124 145.22176 \nL 121.477071 145.052817 \nL 122.087018 144.296023 \nL 123.306913 143.987986 \nL 123.91686 144.411872 \nL 124.526807 144.259812 \nL 125.136754 145.233971 \nL 126.356649 144.922603 \nL 126.966596 145.31655 \nL 127.576543 144.083571 \nL 128.18649 145.01258 \nL 128.796437 144.864936 \nL 129.406384 145.244567 \nL 130.016332 145.097511 \nL 130.626279 144.438407 \nL 131.236226 144.301449 \nL 131.846173 144.672399 \nL 132.45612 144.535798 \nL 133.066067 145.394414 \nL 133.676015 144.761853 \nL 134.285962 145.115745 \nL 135.505856 146.763762 \nL 137.335698 147.730358 \nL 137.945645 147.578522 \nL 138.555592 148.348131 \nL 139.775486 148.945807 \nL 140.385433 148.340717 \nL 140.995381 148.634837 \nL 142.215275 148.333659 \nL 142.825222 148.620936 \nL 143.435169 149.334733 \nL 144.045116 149.182243 \nL 144.655064 148.183281 \nL 145.265011 148.462994 \nL 145.874958 148.320495 \nL 146.484905 148.595005 \nL 147.094852 147.630001 \nL 147.704799 147.08798 \nL 148.924694 147.638956 \nL 149.534641 148.308466 \nL 150.144588 148.174193 \nL 150.754535 148.436111 \nL 151.364482 148.302832 \nL 151.97443 147.782632 \nL 152.584377 148.041817 \nL 153.194324 147.914014 \nL 154.414218 148.420023 \nL 155.024165 148.292253 \nL 155.634113 148.539318 \nL 156.24406 148.412459 \nL 156.854007 148.655457 \nL 157.463954 148.529501 \nL 158.073901 149.131924 \nL 158.683848 148.643502 \nL 159.293796 147.802697 \nL 159.903743 148.041817 \nL 160.51369 148.632003 \nL 161.123637 148.510977 \nL 162.343531 148.968407 \nL 162.953479 148.502237 \nL 164.173373 148.269206 \nL 164.78332 147.815819 \nL 165.393267 148.041817 \nL 166.003214 148.600009 \nL 166.613162 148.152786 \nL 167.223109 148.372744 \nL 167.833056 147.932165 \nL 168.443003 147.823797 \nL 169.05295 148.366937 \nL 169.662897 148.580533 \nL 170.272845 147.827575 \nL 170.882792 148.041817 \nL 172.102686 147.831228 \nL 172.712633 148.355919 \nL 173.932528 148.766525 \nL 174.542475 148.659549 \nL 175.152422 149.16806 \nL 176.372316 148.345621 \nL 177.592211 148.743022 \nL 178.812105 148.537321 \nL 179.422052 148.140392 \nL 180.031999 148.630131 \nL 180.641946 148.822105 \nL 181.251894 148.429923 \nL 181.861841 148.620936 \nL 182.471788 148.521921 \nL 183.081735 148.71049 \nL 183.691682 148.326923 \nL 184.301629 148.230916 \nL 184.911577 148.700308 \nL 186.131471 149.066195 \nL 186.741418 149.524362 \nL 187.961312 149.3262 \nL 188.57126 149.776323 \nL 189.791154 150.121003 \nL 190.401101 150.020944 \nL 191.011048 149.653284 \nL 191.620995 149.823726 \nL 192.230943 149.726534 \nL 192.84089 149.365518 \nL 195.280678 148.994387 \nL 195.890626 149.420932 \nL 196.500573 149.328752 \nL 197.11052 149.493619 \nL 197.720467 149.401953 \nL 198.330414 148.803399 \nL 198.940361 148.7157 \nL 199.550309 148.125671 \nL 200.160256 147.791389 \nL 201.990097 147.547638 \nL 202.600044 147.959818 \nL 205.039833 148.605833 \nL 205.64978 149.00451 \nL 206.869675 148.359961 \nL 207.479622 148.754579 \nL 208.089569 147.962958 \nL 209.309463 148.745557 \nL 209.91941 148.898329 \nL 210.529358 149.282442 \nL 211.749252 148.656981 \nL 212.359199 148.807599 \nL 212.969146 149.185755 \nL 213.579093 148.87727 \nL 214.798988 149.171805 \nL 215.408935 148.642044 \nL 216.018882 148.340717 \nL 216.628829 148.488369 \nL 217.238776 148.857222 \nL 217.848724 148.780136 \nL 218.458671 148.262438 \nL 219.678565 148.55254 \nL 220.288512 148.259845 \nL 221.508407 148.546575 \nL 224.558142 148.183281 \nL 225.16809 148.323676 \nL 225.778037 147.831228 \nL 227.607878 148.250044 \nL 229.43772 149.277273 \nL 230.047667 148.794037 \nL 230.657614 148.72314 \nL 231.267561 148.245463 \nL 231.877508 148.379993 \nL 232.487456 148.7157 \nL 233.097403 148.847554 \nL 233.70735 149.179153 \nL 234.317297 149.308381 \nL 236.147139 149.097013 \nL 236.757086 149.421852 \nL 237.367033 148.95859 \nL 237.97698 149.085863 \nL 239.196874 148.948972 \nL 240.416769 149.586139 \nL 241.026716 149.324295 \nL 242.24661 149.188117 \nL 243.466505 149.433284 \nL 244.076452 149.365518 \nL 244.686399 149.109755 \nL 246.51624 149.47213 \nL 247.126188 149.405366 \nL 247.736135 149.153728 \nL 248.346082 149.273172 \nL 248.956029 149.575908 \nL 249.565976 149.693173 \nL 250.175923 149.443896 \nL 252.005765 149.249106 \nL 253.835606 149.596105 \nL 254.445554 149.352752 \nL 255.055501 149.289153 \nL 255.665448 149.048343 \nL 256.275395 149.163172 \nL 256.885342 149.100783 \nL 257.495289 148.686912 \nL 258.715184 148.566308 \nL 259.325131 148.680848 \nL 261.154972 149.538181 \nL 262.374867 149.071365 \nL 262.984814 148.669051 \nL 263.594761 148.610282 \nL 264.814655 148.832808 \nL 266.03455 148.378759 \nL 266.644497 148.321754 \nL 267.254444 148.097637 \nL 267.864391 147.707915 \nL 268.474338 147.986336 \nL 269.694233 148.20728 \nL 270.30418 147.821859 \nL 270.914127 147.767679 \nL 273.963863 148.311962 \nL 274.57381 148.25731 \nL 275.183757 148.041817 \nL 275.793704 147.666899 \nL 277.623546 147.032922 \nL 278.233493 146.506326 \nL 278.84344 146.616292 \nL 279.453387 146.251813 \nL 280.063335 146.519374 \nL 280.673282 146.157231 \nL 281.893176 146.688375 \nL 282.503123 146.640251 \nL 283.723018 146.854543 \nL 284.332965 146.651932 \nL 284.942912 146.912459 \nL 286.162806 147.12289 \nL 286.772753 147.074501 \nL 287.382701 147.33101 \nL 287.992648 147.434216 \nL 288.602595 147.38538 \nL 289.822489 147.891157 \nL 290.432436 147.841476 \nL 291.652331 148.041817 \nL 293.482172 147.893568 \nL 294.092119 147.548955 \nL 294.702067 147.648574 \nL 295.312014 147.600583 \nL 296.531908 148.090587 \nL 297.751802 147.702232 \nL 298.36175 147.799888 \nL 298.971697 147.752262 \nL 299.581644 147.993685 \nL 300.801538 147.898166 \nL 301.411485 148.137344 \nL 302.021433 148.232382 \nL 302.63138 148.469481 \nL 303.241327 148.420984 \nL 303.851274 148.656393 \nL 305.071168 148.559209 \nL 305.681116 148.370234 \nL 306.291063 147.90143 \nL 306.90101 147.995143 \nL 308.120904 147.345135 \nL 308.730851 147.300548 \nL 309.340799 147.394824 \nL 309.950746 147.350337 \nL 310.560693 147.030155 \nL 311.17064 146.986794 \nL 311.780587 147.080913 \nL 312.390534 147.3115 \nL 313.000482 147.267767 \nL 314.220376 147.45279 \nL 314.830323 147.273425 \nL 315.44027 147.365473 \nL 317.270112 147.236087 \nL 318.490006 147.418153 \nL 319.099953 147.241886 \nL 319.7099 147.332468 \nL 320.319848 147.555301 \nL 320.929795 147.644706 \nL 321.539742 147.601635 \nL 322.149689 147.822248 \nL 322.759636 147.778954 \nL 323.369583 147.60475 \nL 323.979531 147.823797 \nL 325.809372 148.085119 \nL 326.419319 148.30101 \nL 327.029266 147.998722 \nL 327.639214 147.955825 \nL 328.249161 148.041817 \nL 328.859108 147.870629 \nL 329.469055 148.084523 \nL 331.298897 148.338671 \nL 331.908844 148.16875 \nL 333.128738 148.336641 \nL 333.738685 148.293952 \nL 334.348632 148.125671 \nL 334.95858 148.334644 \nL 335.568527 148.417463 \nL 336.788421 147.834061 \nL 337.398368 147.917444 \nL 338.008315 148.124553 \nL 338.618263 148.08309 \nL 341.058051 148.409999 \nL 341.667998 148.613289 \nL 342.887893 148.773335 \nL 343.49784 148.974496 \nL 344.107787 148.810606 \nL 344.717734 148.88968 \nL 345.327681 148.605833 \nL 346.547576 148.763841 \nL 347.157523 148.962409 \nL 347.76747 148.920482 \nL 348.377417 148.998297 \nL 348.987365 148.837174 \nL 349.597312 148.795794 \nL 350.207259 148.992166 \nL 350.817206 149.06917 \nL 351.427153 149.027557 \nL 352.0371 149.22219 \nL 352.647048 149.298216 \nL 353.256995 149.138841 \nL 353.866942 149.332008 \nL 355.696783 149.207345 \nL 356.306731 149.282442 \nL 356.916678 149.241161 \nL 357.526625 149.084231 \nL 358.746519 149.003011 \nL 359.356466 149.07776 \nL 359.966414 149.267067 \nL 360.576361 149.111702 \nL 361.186308 149.185755 \nL 362.406202 148.991197 \nL 363.016149 148.951358 \nL 364.845991 148.380813 \nL 366.065885 148.642044 \nL 367.895727 148.862143 \nL 368.505674 148.711641 \nL 369.725568 149.0796 \nL 369.725568 149.0796 \n\" clip-path=\"url(#p34e39a5591)\" style=\"fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_18\">\n    <path d=\"M 65.361932 185.105455 \nL 65.971879 129.51 \nL 66.581826 148.041817 \nL 67.191773 157.307725 \nL 67.80172 151.748185 \nL 68.411668 157.307725 \nL 69.021615 161.278829 \nL 69.631562 164.257159 \nL 70.241509 160.396361 \nL 70.851456 146.188637 \nL 72.071351 134.142958 \nL 72.681298 138.063146 \nL 73.291245 137.452207 \nL 73.901192 140.629088 \nL 74.511139 139.934146 \nL 75.121086 145.861603 \nL 75.731034 138.775908 \nL 76.950928 143.408867 \nL 77.560875 142.747012 \nL 78.780769 146.430358 \nL 79.390717 148.041817 \nL 80.000664 151.748185 \nL 80.610611 146.616292 \nL 81.220558 143.923641 \nL 81.830505 143.408867 \nL 83.0504 146.188637 \nL 84.270294 145.146223 \nL 84.880241 146.357108 \nL 85.490188 145.861603 \nL 86.100135 148.571304 \nL 87.929977 147.066457 \nL 88.539924 145.190768 \nL 89.149871 146.188637 \nL 89.759819 143.06987 \nL 90.979713 142.439173 \nL 91.58966 143.408867 \nL 92.199607 145.570913 \nL 92.809554 145.22176 \nL 93.419502 146.070353 \nL 94.029449 148.041817 \nL 94.639396 148.798221 \nL 95.249343 147.300548 \nL 97.079185 146.293533 \nL 97.689132 148.041817 \nL 98.299079 147.704875 \nL 98.909026 148.372744 \nL 99.518973 147.066457 \nL 100.12892 147.722305 \nL 100.738868 147.413621 \nL 101.348815 146.188637 \nL 101.958762 143.181013 \nL 102.568709 142.960517 \nL 103.178656 140.982077 \nL 103.788603 142.540184 \nL 104.398551 142.339719 \nL 105.618445 145.275873 \nL 106.228392 145.861603 \nL 106.838339 145.624629 \nL 107.448286 144.6002 \nL 108.058234 145.170695 \nL 108.668181 144.181028 \nL 109.888075 146.789668 \nL 111.107969 147.797983 \nL 111.717917 149.00451 \nL 112.327864 148.754579 \nL 112.937811 149.214718 \nL 113.547758 148.968407 \nL 114.157705 149.414545 \nL 114.767652 149.171805 \nL 115.3776 148.265097 \nL 115.987547 148.703672 \nL 117.817388 148.041817 \nL 118.427335 147.199462 \nL 119.037283 147.000704 \nL 119.64723 147.424093 \nL 120.257177 146.005353 \nL 120.867124 146.430358 \nL 122.087018 146.070353 \nL 122.696966 146.481249 \nL 124.526807 145.96172 \nL 125.136754 146.357108 \nL 125.746701 146.188637 \nL 126.356649 145.47305 \nL 127.576543 145.16309 \nL 128.796437 145.923902 \nL 129.406384 144.720075 \nL 130.016332 144.577932 \nL 131.236226 145.321553 \nL 131.846173 145.177811 \nL 132.45612 146.038383 \nL 133.066067 144.898032 \nL 133.676015 145.253845 \nL 134.895909 144.980039 \nL 135.505856 144.36741 \nL 136.115803 144.240418 \nL 136.72575 144.586738 \nL 137.335698 144.460037 \nL 137.945645 144.798752 \nL 138.555592 144.212931 \nL 139.165539 143.181013 \nL 139.775486 143.521866 \nL 140.385433 143.408867 \nL 140.995381 143.742437 \nL 141.605328 143.629479 \nL 142.215275 143.956066 \nL 143.435169 141.146257 \nL 144.045116 141.056752 \nL 144.655064 141.392998 \nL 145.265011 140.881803 \nL 145.874958 141.214304 \nL 146.484905 141.956741 \nL 147.094852 142.276369 \nL 147.704799 142.182499 \nL 148.314747 142.495805 \nL 148.924694 141.998834 \nL 149.534641 141.90899 \nL 150.144588 142.217533 \nL 150.754535 142.915997 \nL 151.364482 142.821588 \nL 151.97443 143.117282 \nL 152.584377 143.022782 \nL 153.194324 143.696425 \nL 153.804271 143.218467 \nL 155.634113 145.1812 \nL 156.24406 145.447368 \nL 156.854007 144.605453 \nL 158.683848 143.228359 \nL 159.293796 143.857217 \nL 159.903743 144.121629 \nL 160.51369 144.028562 \nL 161.733584 142.447308 \nL 162.343531 142.366453 \nL 164.173373 143.153054 \nL 164.78332 142.730874 \nL 165.393267 142.987689 \nL 166.613162 144.157906 \nL 167.833056 143.984556 \nL 168.443003 143.572384 \nL 169.05295 144.140385 \nL 170.272845 144.613969 \nL 170.882792 144.527165 \nL 171.492739 144.759036 \nL 172.102686 145.304164 \nL 172.712633 145.529027 \nL 173.932528 145.350043 \nL 174.542475 145.570913 \nL 175.152422 144.86786 \nL 175.762369 145.088945 \nL 176.372316 145.003815 \nL 176.982263 145.22176 \nL 178.202158 145.052817 \nL 179.422052 145.478907 \nL 180.641946 145.310817 \nL 181.251894 145.51916 \nL 181.861841 145.435787 \nL 182.471788 145.929386 \nL 184.911577 146.724834 \nL 185.521524 146.357108 \nL 186.131471 146.551823 \nL 186.741418 146.466619 \nL 187.351365 146.935439 \nL 188.57126 146.763762 \nL 189.181207 146.95171 \nL 189.791154 146.866629 \nL 190.401101 147.322137 \nL 191.011048 147.504667 \nL 191.620995 147.418153 \nL 192.84089 147.777082 \nL 193.450837 147.427017 \nL 194.060784 146.818017 \nL 194.670731 146.475748 \nL 195.280678 146.916054 \nL 195.890626 147.093679 \nL 196.500573 147.012277 \nL 197.11052 146.675418 \nL 197.720467 146.086631 \nL 198.940361 146.441343 \nL 200.160256 147.290532 \nL 201.990097 147.794727 \nL 202.600044 147.467826 \nL 203.209992 147.388719 \nL 203.819939 147.066457 \nL 204.429886 147.232567 \nL 205.039833 147.638956 \nL 205.64978 147.319801 \nL 206.259727 147.243038 \nL 210.529358 148.351975 \nL 211.139305 148.273464 \nL 211.749252 147.734235 \nL 212.359199 147.65893 \nL 212.969146 147.355457 \nL 213.579093 147.510167 \nL 214.189041 147.436702 \nL 214.798988 147.815819 \nL 215.408935 147.516629 \nL 216.018882 147.668192 \nL 217.238776 147.078163 \nL 218.458671 147.37997 \nL 219.068618 147.309338 \nL 219.678565 147.020379 \nL 220.288512 147.387758 \nL 220.898459 147.100754 \nL 221.508407 146.599657 \nL 222.118354 146.533416 \nL 223.338248 146.83012 \nL 223.948195 146.337747 \nL 224.558142 146.485714 \nL 225.16809 145.998386 \nL 225.778037 146.357108 \nL 226.387984 146.08374 \nL 226.997931 146.23044 \nL 228.217825 146.105661 \nL 229.43772 146.394545 \nL 230.047667 146.332246 \nL 230.657614 146.066003 \nL 231.267561 146.412646 \nL 231.877508 146.14806 \nL 232.487456 146.087559 \nL 233.097403 145.826055 \nL 233.70735 146.168564 \nL 234.317297 146.108643 \nL 234.927244 145.849881 \nL 235.537191 145.791526 \nL 236.147139 146.129279 \nL 236.757086 145.873201 \nL 237.367033 146.011832 \nL 237.97698 145.953725 \nL 238.586927 146.286177 \nL 239.196874 146.421908 \nL 239.806822 146.169268 \nL 240.416769 146.111418 \nL 241.026716 146.438717 \nL 241.636663 146.188637 \nL 242.856557 146.074404 \nL 243.466505 146.207616 \nL 244.076452 146.150819 \nL 244.686399 146.471324 \nL 245.296346 146.414021 \nL 245.906293 146.169922 \nL 246.51624 146.487139 \nL 248.956029 146.998641 \nL 252.005765 146.713808 \nL 252.615712 147.018962 \nL 253.835606 146.905997 \nL 254.445554 147.207589 \nL 256.275395 147.569674 \nL 256.885342 147.865327 \nL 257.495289 147.983172 \nL 258.105237 147.9249 \nL 258.715184 147.692167 \nL 259.935078 147.925993 \nL 260.545025 147.349045 \nL 261.154972 147.466293 \nL 262.374867 148.041817 \nL 264.204708 148.381857 \nL 264.814655 148.324314 \nL 265.424603 148.098151 \nL 267.864391 148.542681 \nL 268.474338 148.485693 \nL 269.084286 148.760966 \nL 269.694233 148.869135 \nL 270.30418 148.646717 \nL 270.914127 148.590101 \nL 271.524074 148.861812 \nL 272.743969 149.07438 \nL 273.353916 149.017177 \nL 273.963863 149.122388 \nL 274.57381 149.065375 \nL 275.183757 148.686407 \nL 275.793704 148.952343 \nL 276.403652 149.056528 \nL 277.013599 149.319879 \nL 277.623546 149.103815 \nL 278.233493 149.206674 \nL 279.453387 149.726534 \nL 280.063335 149.82675 \nL 280.673282 149.612309 \nL 281.283229 149.712293 \nL 281.893176 149.499377 \nL 282.503123 149.599112 \nL 283.11307 149.853592 \nL 284.332965 150.049434 \nL 284.942912 149.684532 \nL 285.552859 149.782379 \nL 286.772753 149.670988 \nL 287.992648 149.864618 \nL 288.602595 149.506187 \nL 289.212542 149.602923 \nL 289.822489 149.397802 \nL 291.042384 149.290594 \nL 291.652331 149.386867 \nL 292.262278 149.333582 \nL 292.872225 148.983277 \nL 293.482172 148.931351 \nL 294.092119 148.73183 \nL 294.702067 148.680848 \nL 295.312014 148.777212 \nL 295.921961 148.432996 \nL 296.531908 148.383199 \nL 297.141855 148.479579 \nL 297.751802 148.720994 \nL 298.36175 148.525682 \nL 298.971697 148.620936 \nL 299.581644 148.571304 \nL 300.191591 148.809977 \nL 300.801538 148.903764 \nL 301.411485 149.140357 \nL 302.021433 149.089889 \nL 303.241327 148.420984 \nL 303.851274 148.514573 \nL 304.461221 148.466208 \nL 305.071168 148.700308 \nL 306.291063 148.884171 \nL 307.510957 149.345569 \nL 308.120904 149.295855 \nL 309.950746 149.563092 \nL 310.560693 149.789239 \nL 313.000482 149.589933 \nL 313.610429 149.676977 \nL 314.220376 149.491739 \nL 315.44027 149.394505 \nL 316.050217 149.481184 \nL 316.660165 149.298216 \nL 317.880059 149.470779 \nL 318.490006 149.021866 \nL 319.099953 149.108396 \nL 320.929795 148.968407 \nL 321.539742 148.790135 \nL 322.149689 148.876194 \nL 322.759636 148.830406 \nL 323.369583 148.915958 \nL 323.979531 148.739485 \nL 324.589478 148.955359 \nL 325.199425 149.040017 \nL 325.809372 148.604698 \nL 326.419319 148.689787 \nL 327.639214 148.600788 \nL 328.249161 148.685289 \nL 328.859108 148.641 \nL 329.469055 148.212616 \nL 330.079002 148.297431 \nL 330.688949 148.254344 \nL 331.298897 148.338671 \nL 332.518791 147.999608 \nL 333.128738 147.957581 \nL 333.738685 148.167888 \nL 334.348632 148.251453 \nL 334.95858 148.083653 \nL 335.568527 148.292253 \nL 336.178474 148.250044 \nL 336.788421 148.332681 \nL 337.398368 148.166198 \nL 338.008315 148.124553 \nL 338.618263 147.959271 \nL 339.22821 148.041817 \nL 339.838157 148.000726 \nL 340.448104 147.83682 \nL 341.058051 147.796368 \nL 342.277946 147.471612 \nL 342.887893 147.188378 \nL 343.49784 147.393002 \nL 344.107787 147.232567 \nL 345.327681 147.155514 \nL 345.937629 147.237835 \nL 346.547576 147.199462 \nL 347.76747 147.602488 \nL 348.377417 147.683137 \nL 348.987365 147.405536 \nL 350.817206 147.291063 \nL 353.256995 147.610847 \nL 353.866942 147.455366 \nL 354.476889 147.41759 \nL 355.696783 147.808711 \nL 356.306731 147.654125 \nL 356.916678 147.732313 \nL 358.136572 147.309793 \nL 358.746519 147.157518 \nL 361.186308 147.012277 \nL 362.406202 147.282322 \nL 363.016149 147.359665 \nL 363.626097 147.323239 \nL 365.455938 147.553155 \nL 366.065885 147.516629 \nL 366.675832 147.255622 \nL 367.28578 147.331929 \nL 367.895727 147.296075 \nL 369.725568 147.522925 \nL 369.725568 147.522925 \n\" clip-path=\"url(#p34e39a5591)\" style=\"fill: none; stroke: #2ca02c; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_19\">\n    <path d=\"M 65.361932 185.105455 \nL 65.971879 185.105455 \nL 66.581826 148.041817 \nL 67.191773 157.307725 \nL 67.80172 162.867274 \nL 68.411668 166.573634 \nL 69.021615 145.394414 \nL 69.631562 143.408867 \nL 70.241509 135.687272 \nL 70.851456 135.069548 \nL 71.461403 139.618263 \nL 72.071351 129.51 \nL 72.681298 129.51 \nL 73.901192 136.922728 \nL 75.121086 136.050641 \nL 75.731034 138.775908 \nL 76.340981 135.362152 \nL 77.560875 140.09961 \nL 78.170822 137.091199 \nL 78.780769 136.761581 \nL 79.390717 134.142958 \nL 80.000664 136.18146 \nL 80.610611 140.201433 \nL 81.220558 139.805457 \nL 81.830505 141.423311 \nL 82.440452 141.012506 \nL 83.0504 144.335457 \nL 83.660347 145.650617 \nL 84.270294 143.408867 \nL 84.880241 142.987689 \nL 85.490188 144.226443 \nL 86.710083 140.320231 \nL 87.32003 140.028058 \nL 87.929977 141.214304 \nL 88.539924 143.765244 \nL 89.149871 142.018982 \nL 89.759819 143.06987 \nL 90.369766 145.394414 \nL 91.58966 147.199462 \nL 92.199607 145.570913 \nL 92.809554 146.430358 \nL 94.639396 145.394414 \nL 95.249343 146.188637 \nL 95.85929 148.041817 \nL 96.469237 148.754579 \nL 97.079185 148.391475 \nL 97.689132 147.012277 \nL 98.299079 148.7157 \nL 100.12892 150.597934 \nL 100.738868 149.298216 \nL 101.348815 149.895005 \nL 101.958762 151.383623 \nL 102.568709 151.030825 \nL 103.788603 152.095656 \nL 104.398551 151.748185 \nL 105.008498 149.726534 \nL 105.618445 148.595005 \nL 106.838339 148.041817 \nL 107.448286 149.365518 \nL 108.668181 148.813978 \nL 109.278128 147.026377 \nL 109.888075 147.54096 \nL 110.498022 145.818002 \nL 111.107969 147.066457 \nL 111.717917 146.838454 \nL 112.327864 147.329055 \nL 112.937811 147.103496 \nL 114.157705 148.041817 \nL 114.767652 146.459834 \nL 115.987547 146.056269 \nL 116.597494 144.553476 \nL 117.207441 145.025014 \nL 118.427335 144.672399 \nL 119.037283 145.126705 \nL 119.64723 143.717733 \nL 120.257177 143.561597 \nL 120.867124 144.013162 \nL 121.477071 143.857217 \nL 122.696966 144.725601 \nL 123.306913 145.725342 \nL 123.91686 144.985026 \nL 124.526807 145.96172 \nL 125.136754 146.357108 \nL 125.746701 146.188637 \nL 126.356649 147.124406 \nL 126.966596 146.95171 \nL 127.576543 147.322137 \nL 128.18649 147.150866 \nL 128.796437 147.512338 \nL 129.406384 148.391475 \nL 130.626279 148.041817 \nL 131.846173 145.683224 \nL 132.45612 145.036662 \nL 133.676015 144.761853 \nL 134.285962 145.603421 \nL 134.895909 145.946915 \nL 136.72575 144.11559 \nL 137.945645 144.798752 \nL 139.165539 144.548116 \nL 139.775486 143.973861 \nL 140.385433 143.857217 \nL 140.995381 143.297674 \nL 141.605328 143.629479 \nL 142.825222 143.408867 \nL 143.435169 143.732098 \nL 144.045116 143.195039 \nL 144.655064 143.090573 \nL 145.874958 143.722372 \nL 146.484905 143.201418 \nL 147.704799 143.817659 \nL 148.314747 142.901607 \nL 148.924694 143.207432 \nL 149.534641 142.308951 \nL 151.364482 143.213107 \nL 151.97443 143.117282 \nL 152.584377 143.408867 \nL 153.194324 142.546174 \nL 154.414218 142.368814 \nL 155.024165 143.03322 \nL 155.634113 142.196209 \nL 156.24406 142.111634 \nL 156.854007 142.396368 \nL 158.073901 142.227913 \nL 159.293796 142.781177 \nL 159.903743 142.339719 \nL 160.51369 142.258002 \nL 161.123637 142.881061 \nL 162.953479 142.631909 \nL 163.563426 142.894093 \nL 165.393267 142.650748 \nL 166.003214 142.906494 \nL 166.613162 142.826277 \nL 167.223109 142.416093 \nL 167.833056 142.668692 \nL 168.443003 143.24535 \nL 169.05295 142.839905 \nL 170.272845 143.328525 \nL 170.882792 142.61008 \nL 171.492739 142.535222 \nL 172.102686 142.777101 \nL 172.712633 143.330339 \nL 173.32258 143.565035 \nL 173.932528 143.175927 \nL 174.542475 143.408867 \nL 175.152422 143.94639 \nL 175.762369 143.256128 \nL 176.372316 143.181013 \nL 176.982263 143.408867 \nL 177.592211 143.934767 \nL 178.202158 143.857217 \nL 178.812105 143.185885 \nL 179.422052 143.113148 \nL 180.031999 143.335326 \nL 180.641946 142.677349 \nL 181.251894 142.608406 \nL 181.861841 141.961066 \nL 182.471788 141.608491 \nL 183.691682 141.484408 \nL 184.301629 141.990616 \nL 185.521524 142.426117 \nL 186.131471 142.081835 \nL 186.741418 141.463026 \nL 187.351365 141.126962 \nL 188.57126 141.560251 \nL 189.181207 141.501176 \nL 189.791154 141.985082 \nL 190.401101 142.194403 \nL 191.011048 142.133124 \nL 192.84089 142.747012 \nL 193.450837 142.684283 \nL 194.060784 142.884383 \nL 194.670731 143.343611 \nL 195.890626 142.697761 \nL 196.500573 142.894093 \nL 197.11052 142.576213 \nL 197.720467 142.516276 \nL 198.330414 142.203027 \nL 198.940361 141.639922 \nL 200.160256 142.031499 \nL 200.770203 141.975348 \nL 201.38015 141.67151 \nL 201.990097 141.864545 \nL 202.600044 142.301876 \nL 204.429886 142.86262 \nL 205.039833 142.804564 \nL 206.259727 143.169233 \nL 206.869675 143.587817 \nL 208.089569 142.994855 \nL 208.699516 143.173292 \nL 209.309463 142.881061 \nL 209.91941 143.058471 \nL 210.529358 142.769164 \nL 212.359199 143.293996 \nL 212.969146 142.779702 \nL 213.579093 142.725315 \nL 214.189041 143.125218 \nL 214.798988 142.617875 \nL 216.018882 143.408867 \nL 216.628829 143.353047 \nL 217.238776 143.075288 \nL 217.848724 143.021249 \nL 218.458671 142.747012 \nL 219.068618 143.134182 \nL 219.678565 143.080549 \nL 220.288512 143.24535 \nL 220.898459 143.626033 \nL 221.508407 143.787429 \nL 222.118354 143.516605 \nL 222.728301 143.677181 \nL 223.338248 143.622695 \nL 223.948195 143.78163 \nL 224.558142 143.514965 \nL 225.778037 143.408867 \nL 226.387984 143.146625 \nL 227.607878 143.460917 \nL 228.217825 143.408867 \nL 228.827773 142.943849 \nL 230.047667 142.844701 \nL 230.657614 143.000075 \nL 231.267561 142.747012 \nL 231.877508 142.901607 \nL 232.487456 142.650748 \nL 233.70735 142.555867 \nL 234.927244 142.860881 \nL 235.537191 142.813196 \nL 236.757086 143.507442 \nL 237.97698 143.408867 \nL 238.586927 143.165025 \nL 239.806822 143.457297 \nL 240.416769 143.794943 \nL 241.636663 143.696425 \nL 242.856557 143.980049 \nL 243.466505 143.930666 \nL 244.076452 143.692515 \nL 244.686399 143.832902 \nL 245.296346 143.784513 \nL 246.51624 144.061832 \nL 247.126188 144.013162 \nL 248.346082 144.286198 \nL 248.956029 144.23727 \nL 249.565976 144.005184 \nL 250.175923 143.957507 \nL 250.785871 144.092418 \nL 252.005765 144.72179 \nL 252.615712 144.672399 \nL 253.225659 144.44341 \nL 254.445554 144.704898 \nL 255.055501 144.478006 \nL 255.665448 144.78543 \nL 256.275395 144.736785 \nL 256.885342 144.864936 \nL 257.495289 145.168218 \nL 258.105237 145.294198 \nL 258.715184 145.244567 \nL 259.935078 145.493694 \nL 260.545025 145.443905 \nL 261.154972 145.567077 \nL 261.76492 145.517363 \nL 262.984814 145.760981 \nL 263.594761 146.05221 \nL 264.204708 145.661585 \nL 264.814655 145.781841 \nL 265.424603 145.394414 \nL 266.644497 145.634363 \nL 267.864391 145.537519 \nL 269.084286 145.109921 \nL 270.30418 145.677226 \nL 270.914127 145.629392 \nL 271.524074 145.253845 \nL 272.134021 145.044027 \nL 272.743969 144.672399 \nL 275.183757 145.141186 \nL 275.793704 145.41737 \nL 276.403652 145.531744 \nL 277.013599 145.485708 \nL 277.623546 145.599229 \nL 278.233493 145.870948 \nL 278.84344 145.82434 \nL 279.453387 145.93593 \nL 280.063335 145.889397 \nL 280.673282 146.157231 \nL 281.283229 146.110333 \nL 281.893176 146.219869 \nL 282.503123 146.484521 \nL 283.11307 145.815931 \nL 283.723018 145.770508 \nL 284.332965 146.034208 \nL 284.942912 145.988428 \nL 286.162806 145.591334 \nL 286.772753 145.699884 \nL 287.382701 145.503213 \nL 288.602595 145.416061 \nL 289.212542 145.070686 \nL 290.432436 144.68606 \nL 291.042384 144.345448 \nL 293.482172 144.1872 \nL 294.092119 144.296023 \nL 294.702067 144.256805 \nL 295.312014 144.364875 \nL 296.531908 143.994083 \nL 297.141855 144.247908 \nL 297.751802 143.918248 \nL 298.36175 143.880628 \nL 298.971697 143.987986 \nL 300.801538 143.444779 \nL 301.411485 143.122294 \nL 303.241327 143.017845 \nL 303.851274 142.699741 \nL 304.461221 142.807645 \nL 305.071168 143.056102 \nL 305.681116 143.162556 \nL 306.291063 143.408867 \nL 306.90101 143.233818 \nL 308.120904 143.443703 \nL 308.730851 143.68684 \nL 309.340799 143.79013 \nL 309.950746 143.478016 \nL 310.560693 143.443355 \nL 311.17064 143.271255 \nL 311.780587 143.374545 \nL 313.000482 143.03322 \nL 314.220376 142.967095 \nL 314.830323 143.06987 \nL 315.44027 143.036874 \nL 316.050217 142.734163 \nL 319.099953 143.24221 \nL 320.319848 143.176664 \nL 320.929795 143.276491 \nL 321.539742 143.11174 \nL 322.149689 143.079505 \nL 322.759636 143.310291 \nL 323.979531 143.506979 \nL 324.589478 143.343611 \nL 325.199425 143.311219 \nL 325.809372 143.538757 \nL 326.419319 143.376467 \nL 327.029266 143.602804 \nL 327.639214 143.312122 \nL 328.249161 143.280169 \nL 328.859108 143.376765 \nL 329.469055 143.601014 \nL 330.079002 143.44082 \nL 330.688949 143.663893 \nL 331.298897 143.758724 \nL 331.908844 143.980049 \nL 332.518791 143.947094 \nL 333.128738 143.787926 \nL 334.348632 143.723317 \nL 334.95858 143.56574 \nL 335.568527 143.534077 \nL 336.178474 143.752436 \nL 336.788421 143.595845 \nL 337.398368 143.564331 \nL 338.008315 143.284767 \nL 338.618263 143.130272 \nL 339.22821 143.100001 \nL 339.838157 143.193142 \nL 340.448104 143.408867 \nL 341.058051 143.500914 \nL 341.667998 143.470097 \nL 342.887893 143.652709 \nL 343.49784 143.500102 \nL 344.107787 143.590949 \nL 345.937629 143.499315 \nL 346.547576 143.348697 \nL 347.157523 143.438881 \nL 348.377417 143.020297 \nL 348.987365 143.229908 \nL 349.597312 143.200531 \nL 350.207259 143.290069 \nL 350.817206 143.142152 \nL 351.427153 143.113148 \nL 352.0371 142.966225 \nL 352.647048 142.937718 \nL 353.256995 143.144405 \nL 353.866942 142.998351 \nL 354.476889 143.086994 \nL 355.086836 143.058471 \nL 355.696783 142.796967 \nL 356.306731 142.885477 \nL 356.916678 142.85755 \nL 357.526625 142.945572 \nL 358.746519 143.351191 \nL 359.966414 143.52373 \nL 361.186308 143.809242 \nL 362.406202 143.978492 \nL 364.236044 144.456235 \nL 364.845991 144.651853 \nL 366.065885 144.590549 \nL 367.895727 144.275793 \nL 368.505674 144.469423 \nL 369.725568 144.298392 \nL 369.725568 144.298392 \n\" clip-path=\"url(#p34e39a5591)\" style=\"fill: none; stroke: #d62728; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_20\">\n    <path d=\"M 65.361932 240.700909 \nL 66.581826 185.105455 \nL 67.191773 171.206592 \nL 67.80172 173.986366 \nL 68.411668 148.041817 \nL 69.021615 153.336622 \nL 69.631562 164.257159 \nL 70.241509 166.573634 \nL 70.851456 168.426822 \nL 71.461403 164.888924 \nL 72.681298 167.999158 \nL 73.291245 173.192144 \nL 74.511139 160.782446 \nL 75.731034 169.66227 \nL 76.340981 170.475074 \nL 77.560875 166.573634 \nL 78.170822 169.94306 \nL 78.780769 168.185101 \nL 79.390717 171.206592 \nL 80.000664 162.867274 \nL 80.610611 161.584298 \nL 81.220558 162.455458 \nL 81.830505 161.278829 \nL 82.440452 162.100439 \nL 83.0504 157.307725 \nL 83.660347 154.617625 \nL 84.270294 155.570369 \nL 84.880241 154.780662 \nL 85.490188 155.672565 \nL 86.710083 151.130453 \nL 87.32003 150.546123 \nL 87.929977 152.918617 \nL 88.539924 153.743914 \nL 89.149871 153.13807 \nL 90.369766 149.365518 \nL 90.979713 150.19668 \nL 92.199607 146.806369 \nL 93.419502 146.070353 \nL 94.029449 144.567104 \nL 94.639396 145.394414 \nL 95.85929 144.771496 \nL 96.469237 146.616292 \nL 97.079185 147.342508 \nL 97.689132 145.982729 \nL 98.909026 145.394414 \nL 99.518973 146.091105 \nL 100.12892 144.846677 \nL 100.738868 146.471324 \nL 101.348815 146.188637 \nL 101.958762 146.826616 \nL 102.568709 146.547317 \nL 103.788603 147.752262 \nL 104.398551 147.471612 \nL 105.008498 148.884171 \nL 105.618445 148.595005 \nL 106.228392 146.679187 \nL 106.838339 146.430358 \nL 107.448286 146.982859 \nL 108.058234 148.302832 \nL 108.668181 148.813978 \nL 109.278128 148.549541 \nL 109.888075 149.043538 \nL 110.498022 150.265639 \nL 111.107969 149.261019 \nL 111.717917 149.726534 \nL 112.327864 150.892866 \nL 112.937811 150.622199 \nL 113.547758 151.053243 \nL 114.157705 150.787273 \nL 115.3776 151.614219 \nL 115.987547 150.689219 \nL 117.817388 151.875988 \nL 119.037283 148.874711 \nL 119.64723 148.041817 \nL 120.257177 149.060048 \nL 120.867124 147.638956 \nL 122.087018 148.436111 \nL 123.306913 148.041817 \nL 123.91686 148.997071 \nL 126.356649 150.427102 \nL 126.966596 150.222031 \nL 128.18649 151.962013 \nL 129.406384 151.538392 \nL 130.626279 152.160001 \nL 131.236226 152.9723 \nL 131.846173 153.264423 \nL 132.45612 152.048701 \nL 133.066067 151.351074 \nL 133.676015 151.157791 \nL 134.285962 150.480213 \nL 134.895909 150.297866 \nL 136.72575 151.182802 \nL 137.945645 150.821595 \nL 139.165539 151.383623 \nL 140.385433 152.824225 \nL 141.605328 153.336622 \nL 142.215275 152.273497 \nL 142.825222 152.96433 \nL 144.045116 153.458816 \nL 144.655064 154.12478 \nL 146.484905 154.81838 \nL 147.704799 156.081357 \nL 148.314747 156.293213 \nL 148.924694 155.293398 \nL 149.534641 155.507872 \nL 150.144588 154.527955 \nL 150.754535 154.744815 \nL 151.364482 154.567107 \nL 152.584377 155.763411 \nL 153.804271 155.403779 \nL 156.854007 152.705452 \nL 157.463954 152.552854 \nL 158.073901 152.765613 \nL 159.293796 152.465545 \nL 162.343531 155.222898 \nL 162.953479 155.408509 \nL 163.563426 155.248637 \nL 164.78332 155.612743 \nL 165.393267 155.117603 \nL 166.003214 153.958604 \nL 167.833056 153.524602 \nL 169.05295 152.593497 \nL 170.882792 153.154042 \nL 171.492739 153.654311 \nL 172.712633 153.381498 \nL 173.932528 153.735953 \nL 174.542475 153.292499 \nL 175.762369 153.031152 \nL 176.372316 153.206424 \nL 176.982263 153.077636 \nL 177.592211 152.649731 \nL 178.202158 152.525325 \nL 178.812105 152.996855 \nL 180.031999 152.748315 \nL 180.641946 153.211221 \nL 181.861841 153.543449 \nL 182.471788 153.418927 \nL 183.081735 153.009107 \nL 183.691682 152.888603 \nL 184.301629 153.052973 \nL 184.911577 152.651256 \nL 185.521524 152.81517 \nL 186.131471 152.698054 \nL 186.741418 153.13807 \nL 187.351365 153.020515 \nL 187.961312 153.179351 \nL 188.57126 153.062757 \nL 189.791154 152.290579 \nL 190.401101 151.640232 \nL 192.230943 151.322576 \nL 193.450837 151.642791 \nL 194.670731 151.43497 \nL 195.280678 151.592306 \nL 196.500573 150.873066 \nL 197.720467 151.697178 \nL 198.330414 151.849727 \nL 198.940361 151.748185 \nL 199.550309 151.144429 \nL 200.160256 151.297408 \nL 201.38015 152.095656 \nL 201.990097 151.995275 \nL 202.600044 151.649783 \nL 204.429886 151.359739 \nL 205.039833 151.023021 \nL 206.259727 150.837567 \nL 207.479622 150.180103 \nL 208.089569 150.565302 \nL 208.699516 150.711662 \nL 209.309463 150.622199 \nL 209.91941 150.299895 \nL 210.529358 149.747676 \nL 211.139305 149.663358 \nL 211.749252 150.0411 \nL 212.359199 149.726534 \nL 212.969146 149.872124 \nL 213.579093 149.788675 \nL 214.189041 149.252064 \nL 215.408935 149.092208 \nL 216.018882 149.461592 \nL 216.628829 149.381465 \nL 217.848724 149.666125 \nL 218.458671 150.027373 \nL 219.068618 149.726534 \nL 220.288512 150.004011 \nL 221.508407 149.844528 \nL 222.118354 149.981196 \nL 222.728301 150.331467 \nL 223.338248 149.823726 \nL 225.16809 150.226181 \nL 225.778037 150.147711 \nL 226.387984 150.279623 \nL 226.997931 149.783531 \nL 227.607878 149.707604 \nL 228.217825 149.217344 \nL 228.827773 149.350755 \nL 229.43772 148.865457 \nL 230.047667 149.204329 \nL 230.657614 149.131924 \nL 231.877508 149.394505 \nL 232.487456 149.120036 \nL 233.097403 149.048981 \nL 233.70735 149.179153 \nL 234.927244 148.639617 \nL 235.537191 148.571304 \nL 236.147139 148.701319 \nL 236.757086 148.436111 \nL 237.367033 148.36924 \nL 237.97698 148.498592 \nL 239.806822 147.718967 \nL 240.416769 147.65574 \nL 241.636663 147.914014 \nL 242.856557 147.787959 \nL 243.466505 147.535832 \nL 244.686399 148.167458 \nL 245.296346 148.292253 \nL 245.906293 148.22901 \nL 247.126188 147.731923 \nL 247.736135 147.300548 \nL 248.346082 147.241439 \nL 248.956029 146.998641 \nL 249.565976 147.124406 \nL 250.785871 147.008897 \nL 252.005765 146.532711 \nL 252.615712 146.477446 \nL 253.225659 146.602458 \nL 253.835606 146.547317 \nL 255.665448 146.916882 \nL 257.495289 146.223829 \nL 258.105237 146.521859 \nL 258.715184 146.643192 \nL 259.325131 146.240919 \nL 260.545025 146.483072 \nL 261.154972 146.257704 \nL 262.984814 146.103109 \nL 263.594761 145.540592 \nL 264.204708 145.831605 \nL 264.814655 145.951339 \nL 265.424603 146.239329 \nL 266.03455 146.188637 \nL 267.864391 147.040096 \nL 268.474338 146.987614 \nL 269.084286 147.1014 \nL 269.694233 147.37997 \nL 270.30418 147.326942 \nL 270.914127 147.603193 \nL 271.524074 147.549825 \nL 272.134021 147.823797 \nL 273.963863 148.149878 \nL 274.57381 148.09569 \nL 275.183757 148.202964 \nL 275.793704 148.148942 \nL 276.403652 147.935006 \nL 277.623546 147.829422 \nL 278.233493 147.935926 \nL 278.84344 147.566642 \nL 279.453387 147.831228 \nL 281.283229 147.676402 \nL 281.893176 147.781539 \nL 282.503123 147.263169 \nL 283.11307 147.524168 \nL 283.723018 147.31913 \nL 284.332965 147.578522 \nL 284.942912 147.682474 \nL 285.552859 147.632279 \nL 286.162806 147.735511 \nL 286.772753 147.68544 \nL 287.382701 147.483326 \nL 287.992648 147.434216 \nL 289.212542 147.638956 \nL 289.822489 147.589822 \nL 290.432436 147.691214 \nL 291.042384 147.941916 \nL 292.872225 148.24002 \nL 293.482172 148.190074 \nL 296.531908 148.675803 \nL 297.141855 148.6255 \nL 298.36175 148.815991 \nL 298.971697 148.765721 \nL 299.581644 149.00451 \nL 300.191591 148.809977 \nL 300.801538 148.760105 \nL 301.411485 148.567203 \nL 302.63138 148.469481 \nL 303.241327 148.705362 \nL 303.851274 148.514573 \nL 304.461221 148.607681 \nL 305.681116 148.229483 \nL 307.510957 148.088383 \nL 308.120904 148.18116 \nL 308.730851 147.995491 \nL 309.950746 147.903526 \nL 310.560693 147.719928 \nL 311.17064 147.674852 \nL 312.390534 147.859238 \nL 313.000482 147.677561 \nL 313.610429 147.769294 \nL 314.830323 147.680221 \nL 315.44027 147.365473 \nL 316.050217 147.592017 \nL 316.660165 147.279009 \nL 319.7099 147.066457 \nL 320.319848 147.157245 \nL 320.929795 147.115227 \nL 321.539742 147.337521 \nL 322.149689 147.295279 \nL 322.759636 147.121796 \nL 323.369583 147.211383 \nL 325.809372 147.045953 \nL 326.419319 146.745885 \nL 327.639214 146.923891 \nL 328.249161 146.497503 \nL 329.469055 146.675418 \nL 330.079002 146.63596 \nL 330.688949 146.469162 \nL 331.298897 146.175912 \nL 333.128738 146.062284 \nL 333.738685 146.150819 \nL 334.348632 146.113166 \nL 334.95858 146.326687 \nL 335.568527 145.913165 \nL 336.178474 146.126173 \nL 336.788421 146.088918 \nL 337.398368 146.176202 \nL 338.008315 146.138997 \nL 338.618263 146.349602 \nL 339.22821 146.435726 \nL 339.838157 146.644741 \nL 340.448104 146.237838 \nL 341.058051 146.446363 \nL 341.667998 146.409059 \nL 342.277946 146.494106 \nL 342.887893 146.45686 \nL 343.49784 146.176475 \nL 344.107787 146.261473 \nL 344.717734 146.103855 \nL 345.327681 146.309497 \nL 345.937629 146.031863 \nL 346.547576 145.9961 \nL 347.157523 145.600264 \nL 348.987365 145.496677 \nL 349.597312 145.700538 \nL 350.207259 145.665943 \nL 350.817206 145.512955 \nL 351.427153 145.715483 \nL 352.0371 145.681078 \nL 352.647048 145.764601 \nL 353.866942 145.696023 \nL 355.086836 145.394414 \nL 355.696783 145.594225 \nL 356.916678 145.527064 \nL 358.136572 145.691633 \nL 358.746519 145.658056 \nL 360.576361 145.902064 \nL 361.186308 145.868338 \nL 361.796255 145.720587 \nL 362.406202 145.801293 \nL 363.626097 145.62134 \nL 364.236044 145.588525 \nL 364.845991 145.668842 \nL 365.455938 145.523294 \nL 367.895727 146.289317 \nL 369.725568 146.522207 \nL 369.725568 146.522207 \n\" clip-path=\"url(#p34e39a5591)\" style=\"fill: none; stroke: #9467bd; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_21\">\n    <path d=\"M 65.361932 185.105455 \nL 65.971879 185.105455 \nL 66.581826 203.637271 \nL 67.191773 185.105455 \nL 67.80172 173.986366 \nL 68.411668 185.105455 \nL 69.021615 177.163247 \nL 69.631562 178.156025 \nL 70.241509 178.928182 \nL 71.461403 169.94306 \nL 72.681298 163.722585 \nL 73.901192 166.573634 \nL 74.511139 171.206592 \nL 75.121086 165.483527 \nL 75.731034 163.484997 \nL 76.340981 164.622922 \nL 76.950928 160.087504 \nL 77.560875 158.631426 \nL 78.780769 151.264743 \nL 79.390717 154.99125 \nL 80.610611 157.307725 \nL 81.220558 160.396361 \nL 82.440452 154.432105 \nL 83.660347 156.411025 \nL 84.270294 155.570369 \nL 84.880241 156.465371 \nL 85.490188 155.672565 \nL 86.100135 156.513511 \nL 86.710083 158.852047 \nL 87.929977 157.307725 \nL 88.539924 155.169439 \nL 89.149871 157.307725 \nL 89.759819 156.629733 \nL 90.979713 152.782513 \nL 93.419502 150.801878 \nL 94.639396 149.932823 \nL 95.249343 150.636274 \nL 95.85929 148.041817 \nL 96.469237 146.616292 \nL 97.079185 148.391475 \nL 97.689132 148.041817 \nL 98.299079 146.69405 \nL 98.909026 148.372744 \nL 100.12892 145.80522 \nL 100.738868 147.413621 \nL 102.568709 149.237417 \nL 103.178656 148.924284 \nL 103.788603 147.752262 \nL 104.398551 147.471612 \nL 105.008498 144.672399 \nL 105.618445 145.275873 \nL 107.448286 149.365518 \nL 108.058234 149.868901 \nL 108.668181 149.586139 \nL 109.278128 148.549541 \nL 109.888075 149.043538 \nL 111.107969 148.529501 \nL 111.717917 149.726534 \nL 112.327864 149.467341 \nL 112.937811 147.807237 \nL 113.547758 148.273464 \nL 114.157705 147.355457 \nL 114.767652 147.137827 \nL 115.3776 147.595273 \nL 115.987547 146.056269 \nL 116.597494 146.51567 \nL 117.817388 144.846677 \nL 118.427335 145.304164 \nL 120.257177 148.449109 \nL 120.867124 148.847554 \nL 122.696966 148.236889 \nL 123.306913 146.883579 \nL 123.91686 146.704471 \nL 125.136754 145.233971 \nL 125.746701 146.188637 \nL 126.356649 146.023504 \nL 126.966596 145.31655 \nL 127.576543 146.242618 \nL 128.18649 143.94344 \nL 129.406384 144.720075 \nL 130.016332 144.058345 \nL 131.846173 145.177811 \nL 133.066067 146.883579 \nL 133.676015 147.22183 \nL 134.285962 146.578781 \nL 134.895909 146.430358 \nL 136.115803 148.041817 \nL 136.72575 148.355919 \nL 137.335698 147.730358 \nL 137.945645 147.578522 \nL 138.555592 148.348131 \nL 139.165539 148.649417 \nL 140.995381 148.190074 \nL 141.605328 147.600583 \nL 144.045116 148.754579 \nL 144.655064 148.183281 \nL 145.265011 147.199462 \nL 145.874958 147.066457 \nL 146.484905 146.52055 \nL 148.314747 147.365473 \nL 148.924694 148.041817 \nL 149.534641 147.908496 \nL 150.754535 148.436111 \nL 151.364482 148.302832 \nL 153.804271 149.311123 \nL 154.414218 149.176419 \nL 155.024165 148.667891 \nL 155.634113 149.285566 \nL 156.24406 149.153728 \nL 156.854007 149.391821 \nL 157.463954 149.992537 \nL 158.073901 149.858662 \nL 158.683848 150.087542 \nL 159.293796 149.596105 \nL 159.903743 150.180103 \nL 160.51369 149.340226 \nL 161.123637 148.862847 \nL 161.733584 149.090792 \nL 164.173373 147.245971 \nL 164.78332 147.476823 \nL 165.393267 148.041817 \nL 166.003214 147.595273 \nL 166.613162 147.819879 \nL 167.833056 148.919065 \nL 168.443003 149.131924 \nL 169.05295 149.017177 \nL 169.662897 148.580533 \nL 171.492739 149.206674 \nL 172.102686 148.778877 \nL 172.712633 148.041817 \nL 175.152422 147.632279 \nL 175.762369 148.14364 \nL 176.982263 148.545399 \nL 178.202158 148.340717 \nL 178.812105 148.537321 \nL 179.422052 148.436111 \nL 180.641946 147.651673 \nL 181.251894 147.556692 \nL 181.861841 147.752262 \nL 182.471788 147.657737 \nL 183.691682 148.041817 \nL 184.301629 147.37997 \nL 184.911577 147.00705 \nL 185.521524 147.199462 \nL 186.131471 146.831197 \nL 186.741418 146.744592 \nL 187.351365 147.212038 \nL 189.791154 145.781841 \nL 190.401101 146.242618 \nL 191.011048 146.430358 \nL 192.84089 146.188637 \nL 193.450837 146.37308 \nL 194.060784 146.818017 \nL 194.670731 146.475748 \nL 195.890626 146.317931 \nL 196.500573 146.497503 \nL 197.11052 146.93162 \nL 198.940361 147.452169 \nL 199.550309 147.874108 \nL 200.160256 147.54096 \nL 200.770203 146.961485 \nL 201.38015 146.635388 \nL 201.990097 146.806369 \nL 203.209992 146.653978 \nL 203.819939 146.334939 \nL 204.429886 145.775918 \nL 205.039833 145.946915 \nL 205.64978 146.357108 \nL 206.869675 146.689717 \nL 207.479622 146.378705 \nL 208.089569 146.780083 \nL 208.699516 146.706899 \nL 209.309463 146.399756 \nL 209.91941 146.562386 \nL 211.139305 146.420284 \nL 214.189041 147.209776 \nL 214.798988 146.911829 \nL 215.408935 147.291543 \nL 217.238776 147.078163 \nL 217.848724 146.786677 \nL 218.458671 146.938737 \nL 219.068618 146.650101 \nL 219.678565 147.020379 \nL 220.288512 146.95171 \nL 221.508407 147.24863 \nL 222.118354 147.610847 \nL 222.728301 147.111648 \nL 223.338248 147.471612 \nL 224.558142 147.758889 \nL 225.16809 148.112284 \nL 225.778037 148.252405 \nL 226.387984 148.181682 \nL 226.997931 148.320495 \nL 227.607878 148.250044 \nL 228.217825 148.595005 \nL 230.047667 148.999183 \nL 231.267561 149.670988 \nL 231.877508 149.394505 \nL 232.487456 149.726534 \nL 233.097403 149.854718 \nL 233.70735 149.379858 \nL 234.317297 149.508365 \nL 234.927244 149.835225 \nL 235.537191 149.762629 \nL 236.147139 149.492708 \nL 236.757086 149.816146 \nL 237.367033 149.940843 \nL 237.97698 149.673141 \nL 238.586927 149.602393 \nL 239.806822 149.849806 \nL 240.416769 149.586139 \nL 241.026716 149.516666 \nL 241.636663 149.639391 \nL 242.24661 149.570216 \nL 242.856557 149.691914 \nL 244.076452 149.554617 \nL 244.686399 149.298216 \nL 245.906293 149.539341 \nL 246.51624 149.099002 \nL 247.126188 149.219423 \nL 247.736135 149.524362 \nL 248.346082 149.273172 \nL 249.565976 149.142718 \nL 250.175923 149.443896 \nL 252.005765 149.792378 \nL 253.835606 149.596105 \nL 254.445554 149.352752 \nL 255.665448 149.581202 \nL 258.105237 149.32794 \nL 258.715184 149.44045 \nL 259.325131 149.377969 \nL 259.935078 149.142147 \nL 260.545025 149.427377 \nL 261.154972 149.192863 \nL 261.76492 149.131924 \nL 262.374867 148.899771 \nL 264.204708 149.231933 \nL 264.814655 148.832808 \nL 265.424603 149.112049 \nL 266.03455 149.221113 \nL 266.644497 149.161565 \nL 267.254444 148.934921 \nL 267.864391 148.876583 \nL 268.474338 148.985058 \nL 269.084286 148.760966 \nL 269.694233 148.041817 \nL 270.30418 148.316775 \nL 271.524074 147.877819 \nL 272.743969 148.096162 \nL 273.353916 148.041817 \nL 273.963863 147.663619 \nL 274.57381 147.772459 \nL 275.183757 148.041817 \nL 275.793704 148.148942 \nL 277.013599 148.041817 \nL 277.623546 148.307323 \nL 278.84344 148.200214 \nL 279.453387 147.98917 \nL 280.063335 147.936821 \nL 280.673282 148.041817 \nL 281.893176 147.625378 \nL 282.503123 147.730358 \nL 283.11307 147.679467 \nL 283.723018 147.783717 \nL 284.332965 147.732959 \nL 284.942912 147.83648 \nL 286.162806 147.735511 \nL 287.382701 147.940275 \nL 287.992648 147.889923 \nL 288.602595 148.142812 \nL 289.212542 148.092177 \nL 289.822489 148.343152 \nL 290.432436 148.442507 \nL 291.042384 148.391475 \nL 291.652331 147.892367 \nL 292.872225 148.388675 \nL 293.482172 148.338331 \nL 294.092119 148.583971 \nL 294.702067 148.385908 \nL 295.312014 148.335978 \nL 295.921961 148.432996 \nL 296.531908 148.383199 \nL 297.141855 148.187738 \nL 297.751802 148.138843 \nL 299.581644 147.56047 \nL 300.191591 147.801769 \nL 302.021433 148.08946 \nL 302.63138 148.041817 \nL 303.241327 148.136615 \nL 303.851274 148.372744 \nL 305.071168 148.276993 \nL 306.291063 148.462994 \nL 307.510957 148.926504 \nL 308.120904 149.017177 \nL 309.340799 148.642599 \nL 309.950746 148.871604 \nL 310.560693 148.961514 \nL 311.780587 149.414545 \nL 312.390534 149.365518 \nL 313.000482 149.589933 \nL 313.610429 149.540716 \nL 314.830323 149.714207 \nL 315.44027 149.935582 \nL 316.050217 149.886008 \nL 316.660165 150.1059 \nL 317.270112 150.190434 \nL 317.880059 149.87267 \nL 318.490006 150.091013 \nL 320.929795 149.895005 \nL 321.539742 149.978636 \nL 322.149689 149.930131 \nL 322.759636 150.013289 \nL 324.589478 149.477382 \nL 325.199425 149.430625 \nL 325.809372 149.513974 \nL 326.419319 149.726534 \nL 327.029266 149.679512 \nL 328.249161 150.100913 \nL 328.859108 150.181752 \nL 329.469055 150.134125 \nL 330.079002 150.214517 \nL 331.908844 150.834287 \nL 332.518791 150.91235 \nL 333.128738 151.116419 \nL 333.738685 150.941354 \nL 334.348632 151.144429 \nL 334.95858 150.970101 \nL 335.568527 151.04698 \nL 336.178474 150.998582 \nL 336.788421 151.19971 \nL 337.398368 151.275562 \nL 338.008315 151.475174 \nL 338.618263 151.426246 \nL 339.22821 151.253998 \nL 339.838157 151.452334 \nL 341.058051 151.600914 \nL 341.667998 151.797162 \nL 342.277946 151.625999 \nL 344.107787 151.845294 \nL 345.327681 152.231619 \nL 346.547576 152.373937 \nL 347.157523 152.204472 \nL 348.377417 152.106865 \nL 349.597312 152.248188 \nL 350.207259 151.962013 \nL 350.817206 152.032679 \nL 351.427153 151.984762 \nL 352.647048 152.125099 \nL 353.256995 151.959751 \nL 355.086836 152.16865 \nL 356.306731 152.073844 \nL 356.916678 151.910675 \nL 357.526625 151.979833 \nL 358.136572 151.933117 \nL 358.746519 152.001935 \nL 359.966414 151.908993 \nL 362.406202 150.927925 \nL 363.016149 150.997812 \nL 363.626097 150.953963 \nL 364.236044 151.023518 \nL 366.065885 150.555244 \nL 366.675832 150.62504 \nL 367.28578 150.582475 \nL 368.505674 150.38621 \nL 369.115621 150.567199 \nL 369.725568 150.413888 \nL 369.725568 150.413888 \n\" clip-path=\"url(#p34e39a5591)\" style=\"fill: none; stroke: #8c564b; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"line2d_22\">\n    <path d=\"M 50.14375 147.856501 \nL 384.94375 147.856501 \n\" clip-path=\"url(#p34e39a5591)\" style=\"fill: none; stroke-dasharray: 5.55,2.4; stroke-dashoffset: 0; stroke: #000000; stroke-width: 1.5\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 50.14375 251.82 \nL 50.14375 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 384.94375 251.82 \nL 384.94375 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 50.14375 251.82 \nL 384.94375 251.82 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 50.14375 7.2 \nL 384.94375 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"legend_1\">\n    <g id=\"patch_7\">\n     <path d=\"M 302.089063 103.26875 \nL 377.94375 103.26875 \nQ 379.94375 103.26875 379.94375 101.26875 \nL 379.94375 14.2 \nQ 379.94375 12.2 377.94375 12.2 \nL 302.089063 12.2 \nQ 300.089063 12.2 300.089063 14.2 \nL 300.089063 101.26875 \nQ 300.089063 103.26875 302.089063 103.26875 \nz\n\" style=\"fill: #ffffff; opacity: 0.8; stroke: #cccccc; stroke-linejoin: miter\"/>\n    </g>\n    <g id=\"line2d_23\">\n     <path d=\"M 304.089063 20.298437 \nL 314.089063 20.298437 \nL 324.089063 20.298437 \n\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_18\">\n     <!-- P(die=1) -->\n     <g transform=\"translate(332.089063 23.798437)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-50\" d=\"M 1259 4147 \nL 1259 2394 \nL 2053 2394 \nQ 2494 2394 2734 2622 \nQ 2975 2850 2975 3272 \nQ 2975 3691 2734 3919 \nQ 2494 4147 2053 4147 \nL 1259 4147 \nz\nM 628 4666 \nL 2053 4666 \nQ 2838 4666 3239 4311 \nQ 3641 3956 3641 3272 \nQ 3641 2581 3239 2228 \nQ 2838 1875 2053 1875 \nL 1259 1875 \nL 1259 0 \nL 628 0 \nL 628 4666 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-28\" d=\"M 1984 4856 \nQ 1566 4138 1362 3434 \nQ 1159 2731 1159 2009 \nQ 1159 1288 1364 580 \nQ 1569 -128 1984 -844 \nL 1484 -844 \nQ 1016 -109 783 600 \nQ 550 1309 550 2009 \nQ 550 2706 781 3412 \nQ 1013 4119 1484 4856 \nL 1984 4856 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-3d\" d=\"M 678 2906 \nL 4684 2906 \nL 4684 2381 \nL 678 2381 \nL 678 2906 \nz\nM 678 1631 \nL 4684 1631 \nL 4684 1100 \nL 678 1100 \nL 678 1631 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"DejaVuSans-29\" d=\"M 513 4856 \nL 1013 4856 \nQ 1481 4119 1714 3412 \nQ 1947 2706 1947 2009 \nQ 1947 1309 1714 600 \nQ 1481 -109 1013 -844 \nL 513 -844 \nQ 928 -128 1133 580 \nQ 1338 1288 1338 2009 \nQ 1338 2731 1133 3434 \nQ 928 4138 513 4856 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-50\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"60.302734\"/>\n      <use xlink:href=\"#DejaVuSans-64\" x=\"99.316406\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"162.792969\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"190.576172\"/>\n      <use xlink:href=\"#DejaVuSans-3d\" x=\"252.099609\"/>\n      <use xlink:href=\"#DejaVuSans-31\" x=\"335.888672\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"399.511719\"/>\n     </g>\n    </g>\n    <g id=\"line2d_24\">\n     <path d=\"M 304.089063 34.976562 \nL 314.089063 34.976562 \nL 324.089063 34.976562 \n\" style=\"fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_19\">\n     <!-- P(die=2) -->\n     <g transform=\"translate(332.089063 38.476562)scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-50\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"60.302734\"/>\n      <use xlink:href=\"#DejaVuSans-64\" x=\"99.316406\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"162.792969\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"190.576172\"/>\n      <use xlink:href=\"#DejaVuSans-3d\" x=\"252.099609\"/>\n      <use xlink:href=\"#DejaVuSans-32\" x=\"335.888672\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"399.511719\"/>\n     </g>\n    </g>\n    <g id=\"line2d_25\">\n     <path d=\"M 304.089063 49.654687 \nL 314.089063 49.654687 \nL 324.089063 49.654687 \n\" style=\"fill: none; stroke: #2ca02c; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_20\">\n     <!-- P(die=3) -->\n     <g transform=\"translate(332.089063 53.154687)scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-50\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"60.302734\"/>\n      <use xlink:href=\"#DejaVuSans-64\" x=\"99.316406\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"162.792969\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"190.576172\"/>\n      <use xlink:href=\"#DejaVuSans-3d\" x=\"252.099609\"/>\n      <use xlink:href=\"#DejaVuSans-33\" x=\"335.888672\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"399.511719\"/>\n     </g>\n    </g>\n    <g id=\"line2d_26\">\n     <path d=\"M 304.089063 64.332812 \nL 314.089063 64.332812 \nL 324.089063 64.332812 \n\" style=\"fill: none; stroke: #d62728; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_21\">\n     <!-- P(die=4) -->\n     <g transform=\"translate(332.089063 67.832812)scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-50\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"60.302734\"/>\n      <use xlink:href=\"#DejaVuSans-64\" x=\"99.316406\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"162.792969\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"190.576172\"/>\n      <use xlink:href=\"#DejaVuSans-3d\" x=\"252.099609\"/>\n      <use xlink:href=\"#DejaVuSans-34\" x=\"335.888672\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"399.511719\"/>\n     </g>\n    </g>\n    <g id=\"line2d_27\">\n     <path d=\"M 304.089063 79.010937 \nL 314.089063 79.010937 \nL 324.089063 79.010937 \n\" style=\"fill: none; stroke: #9467bd; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_22\">\n     <!-- P(die=5) -->\n     <g transform=\"translate(332.089063 82.510937)scale(0.1 -0.1)\">\n      <use xlink:href=\"#DejaVuSans-50\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"60.302734\"/>\n      <use xlink:href=\"#DejaVuSans-64\" x=\"99.316406\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"162.792969\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"190.576172\"/>\n      <use xlink:href=\"#DejaVuSans-3d\" x=\"252.099609\"/>\n      <use xlink:href=\"#DejaVuSans-35\" x=\"335.888672\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"399.511719\"/>\n     </g>\n    </g>\n    <g id=\"line2d_28\">\n     <path d=\"M 304.089063 93.689062 \nL 314.089063 93.689062 \nL 324.089063 93.689062 \n\" style=\"fill: none; stroke: #8c564b; stroke-width: 1.5; stroke-linecap: square\"/>\n    </g>\n    <g id=\"text_23\">\n     <!-- P(die=6) -->\n     <g transform=\"translate(332.089063 97.189062)scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"DejaVuSans-36\" d=\"M 2113 2584 \nQ 1688 2584 1439 2293 \nQ 1191 2003 1191 1497 \nQ 1191 994 1439 701 \nQ 1688 409 2113 409 \nQ 2538 409 2786 701 \nQ 3034 994 3034 1497 \nQ 3034 2003 2786 2293 \nQ 2538 2584 2113 2584 \nz\nM 3366 4563 \nL 3366 3988 \nQ 3128 4100 2886 4159 \nQ 2644 4219 2406 4219 \nQ 1781 4219 1451 3797 \nQ 1122 3375 1075 2522 \nQ 1259 2794 1537 2939 \nQ 1816 3084 2150 3084 \nQ 2853 3084 3261 2657 \nQ 3669 2231 3669 1497 \nQ 3669 778 3244 343 \nQ 2819 -91 2113 -91 \nQ 1303 -91 875 529 \nQ 447 1150 447 2328 \nQ 447 3434 972 4092 \nQ 1497 4750 2381 4750 \nQ 2619 4750 2861 4703 \nQ 3103 4656 3366 4563 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#DejaVuSans-50\"/>\n      <use xlink:href=\"#DejaVuSans-28\" x=\"60.302734\"/>\n      <use xlink:href=\"#DejaVuSans-64\" x=\"99.316406\"/>\n      <use xlink:href=\"#DejaVuSans-69\" x=\"162.792969\"/>\n      <use xlink:href=\"#DejaVuSans-65\" x=\"190.576172\"/>\n      <use xlink:href=\"#DejaVuSans-3d\" x=\"252.099609\"/>\n      <use xlink:href=\"#DejaVuSans-36\" x=\"335.888672\"/>\n      <use xlink:href=\"#DejaVuSans-29\" x=\"399.511719\"/>\n     </g>\n    </g>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p34e39a5591\">\n   <rect x=\"50.14375\" y=\"7.2\" width=\"334.8\" height=\"244.62\"/>\n  </clipPath>\n </defs>\n</svg>\n",
      "text/plain": [
       "<Figure size 432x324 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "counts = multinomial.Multinomial(10,fair_probs).sample((500,))\n",
    "cum_counts = counts.cumsum(dim=0)\n",
    "estimates = cum_counts / cum_counts.sum(dim=1,keepdim=True)\n",
    "print(cum_counts)\n",
    "\n",
    "plt.figure(figsize=(6,4.5))\n",
    "for i in range(6):\n",
    "    plt.plot(estimates[:,i].numpy(),label=(\"P(die=\"+str(i+1)+\")\"))\n",
    "plt.axhline(y=0.167,color='black',linestyle='dashed')\n",
    "plt.gca().set_xlabel('Groups of experiments')\n",
    "plt.gca().set_ylabel('Estimated probability')\n",
    "plt.legend();    "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3426d0c9",
   "metadata": {},
   "source": [
    "概率论公理\n",
    "* 概率（probability）可以被认为是将集合映射到真实值的函数\n",
    "![1.png](https://tva1.sinaimg.cn/large/005T39qaly1gzk1eh6dbej30gh045tbf.jpg)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "88fca697",
   "metadata": {},
   "source": [
    "* 离散（discrete）随机变量（如骰子的每一面） 和连续（continuous）随机变量（如人的体重和身高）之间存在微妙的区别。\n",
    "* A=a 和 B=b 同时发生的可能性不大于 A=a 或是 B=b 单独发生的可能性。\n",
    "* 当我们处理多个随机变量时，会有若干个变量是我们感兴趣的; 我们需要估计这些概率以及概率之间的关系，以便我们可以运用我们的推断来解决问题。\n",
    "* 条件概率：用 P(B=b∣A=a) 表示它：它是 B=b 的概率，前提是 A=a 已发生。\n",
    "* 如果两个随机变量 A 和 B 是独立的，意味着事件 A 的发生跟 B 事件的发生无关；根据贝叶斯定理，马上就能同样得到 P(A∣B)=P(A) 。 在所有其他情况下，我们称 A 和 B 依赖。\n",
    "* P(A,B)=P(B∣A)P(A)和P(A,B)=P(A∣B)P(B) ---> P(A|B) = P(B|A)P(A) / P(B)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.12 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "vscode": {
   "interpreter": {
    "hash": "6ca3aa8ecd0b7bddf142c4852696022db00ef254c6fe98093bb8bf9134bdc29e"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
